#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const long long NINF = -INF;
const long long MAXN = 1e+6 + 8;
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
long long t = 1;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
;
long long n, a[200000];
set<long long> pf;
void prime(long long n) {
  while (n & 1 ^ 1) n /= 2;
  for (long long i = 3; i * i <= n; i += 2)
    if (n % i == 0) pf.insert(i), n /= i;
  if (n > 2) pf.insert(n);
}
void MAIN(long long tc) {
  cin >> n;
  if (n % 4 == 0) pf.insert(4);
  prime(n);
  for (long long i = (1); i <= (n); i++) cin >> a[i];
  for (auto &(i) : (pf)) {
    for (long long j = (1); j <= (n / i); j++) {
      long long fg = 0;
      for (long long k = j; k <= n; k += n / i) fg = (a[k] == 0) ? 1 : fg;
      if (!fg) {
        cout << "YES\n";
        goto tim;
      }
    }
  }
  cout << "NO\n";
tim:;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed;
  cout << setprecision(10);
  ;
  for (long long i = (1); i <= (t); i++) {
    MAIN(i);
  }
}
