#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> fact;
  for (int i = 3; i <= n; i++)
    if (n % i == 0) fact.push_back(i);
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < fact.size(); i++) {
    int d = n / fact[i];
    bool pos[d];
    memset(pos, true, sizeof(pos));
    for (int j = 0; j < n; j++) {
      if (a[j] == 0) pos[j % d] = false;
    }
    if (count(pos, pos + d, true)) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
