#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
long long int shouldendl = 1;
long long int INF = (long long int)(1e9 + 7);
long long int MOD = (long long int)(1e9 + 7);
using namespace std;
long long int modInverse(long long int a) {
  long long int m = MOD, m0 = m, y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long int q = a / m, t = m;
    m = a % m, a = t, t = y;
    y = x - q * y, x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long int add(long long a, long long b) {
  return ((a % MOD) + (b % MOD)) % MOD;
}
long long int mul(long long a, long long b) {
  return ((a % MOD) * (b % MOD)) % MOD;
}
long long int sub(long long a, long long b) {
  long long int ans = ((a % MOD - b % MOD)) % MOD;
  if (ans < 0) ans += MOD;
  return ans;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void MAIN(long long int i, long long int t);
int get() {
  long long int t;
  cin >> t;
  ;
  return t;
}
template <class T>
int logd(T name) {
  cout << name << endl;
  return 0;
}
void test(int t) {
  for (long long int i = 1; i <= t; i++) {
    MAIN(i, t);
    if (shouldendl) cout << endl;
  }
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x = x % MOD;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % MOD;
    y = y >> 1;
    x = (x * x) % MOD;
  }
  return res;
}
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U> &l, const std::pair<T, U> &r) {
  return {l.first + r.first, l.second + r.second};
}
long long int popcount(long long int x) { return __builtin_popcountll(x); }
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
template <class T>
bool input(vector<T> &v, long long int n = -1) {
  if (n == -1) assert(v.size() != 0);
  if (n == -1) n = v.size();
  for (auto &i : v) cin >> i;
  return 0;
}
template <class T>
bool print(vector<T> v, long long int l = 0, long long int r = -1) {
  if (r == -1) r = v.size();
  for (int i = l; i < r; i++) cout << v[i] << " ";
  return 0;
}
void MAIN(long long int current_test_case, long long int total_test_cases) {
  long long int n;
  cin >> n;
  vector<int> v(n);
  input(v);
  vector<int> div;
  for (int i = 1; i <= n; i++)
    if (n % i == 0 && n / i > 2) div.push_back(i);
  for (auto k : div) {
    for (int i = 0; i < k; i++) {
      int ok = v[i % n];
      for (int j = i; j <= n + k; j += k) ok = min(ok, v[j % n]);
      if (ok == 1) {
        cout << "YES";
        return;
      }
    }
  }
  cout << "NO";
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  test(1);
  return 0;
}
