#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool good[100001];
  for (int i = 0; i < n; i++) cin >> good[i];
  vector<int> d;
  for (int i = 1; i <= n / 3; i++)
    if (n % i == 0) d.push_back(i);
  for (int j = 0; j < d.size(); j++) {
    for (int start = 0; start < d[j]; start++) {
      if (good[start] == 0) continue;
      int temp = start + d[j];
      bool flag = true;
      while (temp != start) {
        if (!good[temp]) flag = false;
        temp += d[j];
        temp %= n;
      }
      if (flag) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}
