func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 7;   const int inf = 0x3f3f3f3f;   const int mod = 1e9 + 7;   long long ans;   int a[maxn];   int ned[maxn];   int n;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       ned[i] = a[i] + 1;     }     for (int i = 2; i <= n; i++) {       ned[i] = max(ned[i], ned[i - 1]);     }     for (int i = n; i >= 1; i--) {       ned[i] = max(ned[i + 1] - 1, ned[i]);       ans += (ned[i] - a[i] - 1);     }     printf( %I64d n , ans);   }   