#include <bits/stdc++.h>
using namespace std;
int n;
long long m;
vector<long long> a;
int gcd(int x, int y) { return (y ? gcd(y, x % y) : x); }
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  m = 0;
  for (int d = 1; d < n; ++d) {
    if (n % d == 0) {
      vector<long long> b(d, 0);
      for (int i = 0; i < n; ++i) b[i % d] = max(b[i % d], a[i]);
      vector<long long> c(n, 0);
      for (int i = 0; i < n; ++i)
        if (a[i] == b[i % d]) c[i] = 1;
      bool fl = true;
      for (int i = 0; i < n; ++i)
        if (c[i] == 0) fl = false;
      if (fl) {
        for (int j = 1; j * d < n; ++j)
          if (gcd(n, j * d) == d) m += n;
      } else {
        vector<long long> w;
        int be = 0;
        while (c[be] == 1) ++be;
        vector<long long> cc;
        for (int i = be; i < n; ++i) cc.push_back(c[i]);
        for (int i = 0; i < be; ++i) cc.push_back(c[i]);
        swap(c, cc);
        for (int i = 1; i < n; ++i) {
          if (c[i] == 1 && c[i - 1] == 0)
            w.push_back(1);
          else if (c[i] == 1 && c[i - 1] == 1)
            ++w.back();
        }
        for (int i = 0; i < w.size(); ++i) {
          for (int j = 1; j * d < n && j * d <= w[i]; ++j) {
            if (gcd(n, j * d) == d) m += (w[i] - j * d + 1);
          }
        }
      }
    }
  }
  cout << m << endl;
  return 0;
}
