#include <bits/stdc++.h>
using namespace std;
int a[110000], b[11000], t;
void init() {
  t = 0;
  long long i;
  for (i = 2; i < 110000; i++) {
    if (!a[i]) {
      b[t++] = i;
      long long j = i * i;
      while (j < 110000) {
        a[j] = 1;
        j += i;
      }
    }
  }
}
int main() {
  init();
  int n, i, k, j, q = 1;
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]), q &= a[i];
  }
  if (!q) {
    b[0] = 4;
    for (i = 3; i <= n; i++) {
      if (n % i == 0) {
        int rr = n / i;
        for (k = 0; k < rr; k++) {
          int z = 1;
          for (j = k; j < n; j += rr) {
            z &= a[j];
          }
          if (z) {
            cout << "YES" << endl;
            break;
          }
        }
        if (k < rr) break;
      }
    }
    if (i > n) cout << "NO" << endl;
  } else
    cout << "YES" << endl;
}
