#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, N;
  cin >> n;
  N = n;
  vector<int> a(n, 0), prs;
  for (int& x : a) cin >> x;
  if (n % 4 == 0) prs.push_back(4);
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0 && i != 2) prs.push_back(i);
    while (n % i == 0) {
      n /= i;
    }
  }
  if (n != 1) prs.push_back(n);
  n = N;
  for (int p : prs) {
    for (int i = 0; i < n; ++i) {
      int d = n / p;
      if (a[i] == 0) continue;
      bool ok = 1;
      for (int j = (i + d) % n; j != i; j = (j + d) % n) {
        if (a[j] == 0) ok = 0;
      }
      if (ok) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
