#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k;
  vector<int> v;
  cin >> n;
  int nn = n;
  while (nn--) {
    cin >> k;
    v.push_back(k);
  }
  for (int x = 1; x * 3 <= n; ++x) {
    if (n % x != 0) {
      continue;
    }
    for (int y = 0; y < x; ++y) {
      int z;
      for (z = y; z < n; z += x) {
        if (v[z] == 0) {
          break;
        }
      }
      if (z >= n) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
