func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, a[4000005], t[4000005];   long long ans, now;   int k;   template <class T>   inline T Max(T a, T b) {     return a > b ? a : b;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , a + i);     int fu = 0, zh = 0;     for (int i = 1; i <= n; ++i) {       int qwq = a[i] - i;       now += qwq < 0 ? -qwq : qwq;       if (i == n) continue;       if (qwq <= 0)         ++fu;       else         ++t[a[i] - i], ++zh;     }     ans = now;     int las = n;     for (int i = 1; i < n; ++i) {       now += -zh + fu - (n - a[las]) + a[las] - 1;       fu += t[i];       zh -= t[i];       if (a[las] != 1) --fu, ++zh;       ++t[i + a[las] - 1];       if (now < ans) ans = now, k = i;       --las;     }     printf( %lld %d n , ans, k);     return 0;   }   