#include <bits/stdc++.h>   using namespace std;   long long h[100000];   int main() {     int n;     cin >> n;     for (int j = 0; j < n; ++j) {       cin >> h[j];     }     long long max = h[n - 1];     long long answer[100000];     answer[n - 1] = 0;     for (int i = n - 2; i >= 0; --i) {       if (h[i] > max) {         max = h[i];         answer[i] = 0;       } else {         answer[i] = max - h[i] + 1;       }     }     for (int i = 0; i < n; ++i) {       cout << answer[i] <<    ;     }     cout << endl;   }   