#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
long long N;
bool is_Polygon(long long M) {
  for (int i = 0; i < M; ++i) {
    long long st = i;
    bool flag = 0;
    while (st < N) {
      if (a[st] == 0) {
        flag = 1;
        break;
      }
      st += M;
    }
    if (flag == 0) {
      return 1;
    }
  }
  return 0;
}
int main() {
  long long x;
  scanf("%lld", &N);
  for (long long n = 0; n < N; ++n) {
    scanf("%lld", &x);
    a.push_back(x);
  }
  vector<long long> Factors;
  for (long long n = 1; n <= N; ++n) {
    if (N % n == 0 && N / n >= 3) {
      Factors.push_back(n);
    }
  }
  for (long long n = 0; n < Factors.size(); ++n) {
    if (is_Polygon(Factors[n])) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
