func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1e7;   int gcd(int a, int b) {     if (a == 0) return b;     return gcd(b % a, a);   }   int main() {     int n, ans = INT_MAX, count = 0;     cin >> n;     vector<int> v(n);     for (int i = 0; i < n; i++) {       cin >> v[i];       count += (v[i] == 1);     }     if (count > 0) {       cout << n - count << endl;     } else {       vector<vector<int>> dp(n, vector<int>(n));       for (int i = 0; i < n; i++) dp[i][i] = v[i];       for (int i = 0; i < n; i++)         for (int j = i + 1; j < n; j++) dp[i][j] = gcd(v[j], dp[i][j - 1]);       for (int i = 0; i < n; i++)         for (int j = i; j < n; j++)           if (dp[i][j] == 1) ans = min(ans, j - i);       if (ans == INT_MAX)         cout << -1 << endl;       else         cout << ans + n - 1 << endl;     }     return 0;   }   