func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int TESTS = 1;     while (TESTS--) {       long long n;       cin >> n;       vector<long long int> a(n);       for (long long int i = 0; i < n; i++) cin >> a[i];       vector<long long int> t(n);       t[0] = 1;       for (long long int i = 1; i < n; i++) t[i] = max(a[i] + 1, t[i - 1]);       for (int i = n - 2; i >= 0; i--) t[i] = max(t[i + 1] - 1, t[i]);       long long s = 0;       for (long long int i = 0; i < n; i++) s += t[i] - a[i] - 1;       cout << s;     }     return 0;   }   