func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, a[100100];     vector<vector<int> > b1;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     if (n < 3) {       cout << 0;       return 0;     }     for (int i = a[1] - 1; i <= a[1] + 1; i++) {       for (int j = a[2] - 1; j <= a[2] + 1; j++) {         vector<int> a1(n + 1, 0);         a1[1] = i;         a1[2] = j;         int k = j - i, b = 0;         for (int j = 3; j <= n; j++) {           a1[j] = a1[j - 1] + k;           if (abs(a1[j] - a[j]) > 1) {             b = 1;             break;           }         }         if (b == 1) continue;         b1.push_back(a1);       }     }     int k = 0, min1 = 1000000;     for (int i = 0; i < b1.size(); i++) {       k = 0;       for (int j = 1; j <= n; j++) {         if (a[j] != b1[i][j]) k++;       }       min1 = min(k, min1);     }     if (b1.size() == 0)       cout << -1;     else       cout << min1;   }   