#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, dummy, count = 0;
  cin >> n;
  vector<int> v, arr;
  for (int i = 0; i < n; i++) {
    cin >> dummy;
    if (dummy == 1) count++;
    arr.push_back(dummy);
  }
  if (count == n) {
    cout << "YES";
    return 0;
  }
  v.push_back(1);
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      v.push_back(i);
      if (i != n / i) v.push_back(n / i);
    }
  }
  sort(v.begin(), v.end());
  int len = v.size();
  for (int i = 0; i < len; i++) {
    bool flag = false;
    int side = v[i];
    for (int i = 0; i <= side && side < n / 2; i++) {
      if (arr[i] == 0) continue;
      flag = true;
      int beg = i, cur = (i + side) % n;
      while (cur != beg) {
        if (arr[cur] != 1) {
          flag = false;
          break;
        }
        cur = (cur + side) % n;
      }
      if (flag) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
