#include <iostream>
#include <vector>
using namespace std;

int main() {
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;

    vector<int> ted(n);

    for (int i = 0; i < n; i++) {
        cin >> ted[i];
    }

    int x = 0;

    
    for (int i = 0; i < n; i++) {
        if (ted[i] != 0) {
            if (x == 0 || ted[i] < x) {
                x = ted[i];
            }
        }
    }

    cout << x << endl;

    
    for (int i = 0; i < n; i++) {
        if (ted[i] != 0) {
            cout << ted[i] - x << " ";
        } else {
            cout << 0 << " ";
        }
    }

    return 0;
}