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