#include <bits/stdc++.h>
using namespace std;
int a[100004];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 3; i <= n; i++)
    if (n % i == 0) {
      int d = n / i;
      bool yes;
      for (int r = 0; r < d; r++) {
        yes = true;
        for (int j = 0; j < n; j += d)
          if (a[r + j] == 0) {
            yes = false;
            break;
          }
        if (yes) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  cout << "NO" << endl;
  return 0;
}
