#include <bits/stdc++.h>
using namespace std;
double tick() {
  static clock_t oldt, newt = clock();
  double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC;
  oldt = newt;
  return diff;
}
vector<int> prime;
void simpleSieve(int limit) {
  bool mark[limit + 1];
  memset(mark, true, sizeof(mark));
  for (int p = 2; p * p <= limit; p++) {
    if (mark[p] == true) {
      for (int i = p * 2; i < limit; i += p) mark[i] = false;
    }
  }
  for (int p = 3; p <= limit; p++) {
    if (mark[p] == true) {
      prime.push_back(p);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, a[100001], x;
  cin >> n;
  simpleSieve(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  prime.push_back(4);
  for (auto it = prime.begin(); it != prime.end(); ++it) {
    if (n % (*it) == 0) {
      x = n / (*it);
      for (int j = 0; j < x; ++j) {
        int flag = 1;
        for (int i = j; i < n + j; i += x) {
          if (a[i % n] == 0) {
            flag = 0;
            break;
          }
        }
        if (flag) {
          cout << "YES";
          exit(0);
        }
      }
    }
  }
  cout << "NO";
}
