#include <bits/stdc++.h>
using namespace std;
int a[111111];
int main() {
  int n = ({
    int t;
    scanf("%d", &t);
    t;
  });
  for (int i = 0; i < n; i++)
    a[i] = ({
      int t;
      scanf("%d", &t);
      t;
    });
  for (int jump = 1; jump < n; jump++) {
    if (n % jump == 0 && n / jump > 2) {
      for (int start = 0; start < n; start++) {
        bool ok = a[start];
        for (int i = (start + jump) % n; i != start && ok; i = (i + jump) % n)
          ok &= a[i];
        if (ok) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
