#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 200001;
bool bs[200001];
vector<int> p;
vector<int> sol;
vector<int> g;
bool vis[200001];
void sieve() {
  memset(bs, true, sizeof bs);
  bs[0] = bs[1] = false;
  for (int i = 2; i * i < N; i++)
    if (bs[i])
      for (int j = i * i; j < N; j += i) bs[j] = false;
  bs[2] = false;
  bs[4] = true;
  for (int i = 0; i < N; i++)
    if (bs[i]) p.push_back(i);
}
void primeFact(int x) {
  sol.clear();
  int freq;
  for (int i = 0; i < p.size() && p[i] <= x; i++) {
    freq = 0;
    while (x % p[i] == 0) {
      ++freq;
      x /= p[i];
    }
    if (freq != 0) sol.push_back(p[i]);
  }
  if (x != 1 && x != 2) sol.push_back(x);
}
vector<int> pos;
bool trY(int x) {
  pos.clear();
  int r;
  for (int i = 0, cnt = 0; i < n && cnt < x; i += n / x, ++cnt) {
    pos.push_back(i);
    r = i;
    vis[r] = true;
  }
  while (r < n) {
    bool flag = true;
    for (int i = 0; i < pos.size(); ++i) {
      if (g[pos[i]] == 0) {
        flag = false;
        break;
      }
    }
    if (flag) return true;
    for (int i = 0; i < pos.size(); ++i) {
      pos[i]++;
      if (pos[i] == false) return false;
      r = pos[i];
      vis[pos[i]] = false;
    }
  }
  return false;
}
int main() {
  sieve();
  scanf("%d", &n);
  for (int i = 0, tmp; i < n; ++i) {
    scanf("%d", &tmp);
    g.push_back(tmp);
  }
  primeFact(n);
  for (int i = 0; i < sol.size(); ++i) {
    memset(vis, false, sizeof vis);
    if (trY(sol[i])) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
