func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int gcd(int a, int b) {     while (b > 0) {       int t = a;       a = b;       b = t % b;     }     return a;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     vector<int> a(n);     for (int i = 0; i < n; ++i) cin >> a[i];     {       int i;       for (i = 1; i < n; ++i)         if (a[i] != a[i - 1]) break;       if (i == n) {         cout << (int64_t)n * (n - 1) << endl;         return 0;       }     }     int64_t ans = 0;     for (int divisor = 1; divisor < n; ++divisor) {       if (n % divisor > 0) continue;       vector<int> max_of_rem(a.begin(), a.begin() + divisor);       for (int i = divisor; i < n; ++i)         if (a[i] > max_of_rem[i % divisor]) max_of_rem[i % divisor] = a[i];       int lim = n;       for (int left = 0; left < lim;) {         int offs;         for (offs = 0; offs < n - 1 && a[(left + offs) % n] ==                                            max_of_rem[(left + offs) % divisor];              ++offs)           ;         if (offs == 0) {           ++left;           continue;         }         int goffs = offs;         if (left == 0) {           while (left + offs < lim &&                  a[lim - 1] == max_of_rem[(lim - 1) % divisor])             --lim;           offs += n - lim;         }         for (int i = divisor; i <= offs; i += divisor) {           if (gcd(n, i) == divisor) {             ans += offs == n ? n : offs - i + 1;           }         }         left += goffs;       }     }     cout << ans << endl;   }   