#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
const long long MOD = 1000000000 + 9;
bool a[maxn * 2];
int n;
int at[maxn * 2][300 + 10];
vector<int> d;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i + n] = a[i];
  }
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      if (n / i >= 3) d.push_back(i);
      if (i * i != n) {
        if (i >= 3) {
          d.push_back(n / i);
        }
      }
    }
  }
  n = n * 2;
  bool can = false;
  for (int i = 0; i < n && !can; i++) {
    for (int j = 0; j < d.size() && !can; j++) {
      if (!a[i]) continue;
      ++at[i][j];
      if (i - d[j] >= 0) {
        at[i][j] += at[i - d[j]][j];
      }
      can |= at[i][j] == n / d[j];
      if (can) break;
    }
  }
  if (can) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
