#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100005];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int sq = sqrt(n);
  vector<int> div;
  for (int i = 1; i <= sq; i++)
    if (n % i == 0) {
      if (n / i > 2) div.push_back(i);
      if (i > 2) div.push_back(n / i);
    }
  bool ok = 0;
  for (int i = 0; i < (int)div.size() && !ok; i++) {
    for (int j = 0; j < div[i]; j++) {
      int s = j;
      if (!a[s]) continue;
      s += div[i];
      while (s != j)
        if (a[s] != 1)
          break;
        else
          s = (s + div[i]) % n;
      if (s == j) {
        ok = 1;
        break;
      }
    }
  }
  if (ok)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
