#include <bits/stdc++.h>
using namespace std;
const long long N = 200005, INF = 2000000000000000000;
long long power(long long a, long long b, long long p) {
  if (a == 0) return 0;
  long long res = 1;
  a %= p;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    b >>= 1;
    a = (a * a) % p;
  }
  return res;
}
vector<long long> prime;
bool isprime[N];
void pre() {
  for (long long i = 2; i < N; i++) {
    if (isprime[i]) {
      for (long long j = (i * i); j < N; j += i) isprime[j] = false;
    }
    prime.push_back(i);
  }
  return;
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(std::numeric_limits<double>::max_digits10);
  ;
  memset(isprime, false, sizeof(isprime));
  pre();
  long long n;
  cin >> n;
  long long ar[n];
  for (long long i = 0; i < n; i++) cin >> ar[i];
  long long temp = n;
  vector<long long> v;
  long long x = prime.size();
  if (n % 2 == 0 && n > 4) v.push_back(2);
  for (long long i = 1; i < x; i++) {
    if (temp % prime[i] == 0) {
      v.push_back(n / prime[i]);
      temp /= prime[i];
    }
    if (prime[i] > temp) break;
  }
  long long n1 = v.size();
  vector<long long> vv[n1];
  long long f = 0;
  for (long long i = 0; i < n; i++) {
    if (ar[i] == 0) f = 1;
    for (long long j = 0; j < n1; j++) {
      if (i < v[j])
        vv[j].push_back(ar[i]);
      else
        vv[j][i % v[j]] = min(vv[j][i % v[j]], ar[i]);
    }
  }
  for (long long i = 0; i < n1; i++) {
    for (long long j = 0; j < v[i]; j++) {
      if (vv[i][j] == 1 && (n / v[i]) > 2 && v[i] > 1) {
        cout << "YES";
        return 0;
      }
    }
  }
  if (f == 0)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
