func_code_string: #include <bits/stdc++.h>   using namespace std;   signed main() {     cin.tie(0);     cout.tie(0);     cin.sync_with_stdio(0);     cout.sync_with_stdio(0);     long long n;     cin >> n;     vector<long long> v(n);     vector<long long> msuf(n + 1);     for (long long i = 0; i < n; ++i) cin >> v[i];     for (long long i = n - 1; i >= 0; --i)       msuf[i] = max(v[i] + 1, msuf[i + 1] - 1);     for (long long i = 1; i < n; ++i) msuf[i] = max(msuf[i], msuf[i - 1]);     long long second = 0;     for (long long i = 0; i < n; ++i) second += msuf[i] - v[i] - 1;     cout << second << endl;     return 0;   }   