func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 1000005;   long long res[MAX], a[MAX], b[MAX];   void add(int l, int r, int x, int y) {     a[l] += x;     a[r] -= x + y * (r - l);     b[l] += y;     b[r] -= y;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     for (int from = 0; from < n; from++) {       int to;       cin >> to;       to--;       if (from <= to) {         add(0, to - from + 1, to - from, -1);         add(to - from + 1, n - from, 1, 1);         add(n - from, n, to, -1);       } else {         add(0, n - from, from - to, 1);         add(n - from, n - from + to + 1, to, -1);         add(n - from + to + 1, n, 1, 1);       }     }     long long val = 0, step = 0;     for (int i = 0; i < n; i++) {       val += a[i];       step += b[i];       res[i] = val;       val += step;     }     int mn = min_element(res, res + n) - res;     cout << res[mn] <<     << mn <<   n ;     return 0;   }   