#include <bits/stdc++.h>
using namespace std;
int a[100002];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int p;
  for (int i = 1; i <= n / 3; i++) {
    if (n % i == 0) {
      for (int j = 1; j <= i; j++) {
        if (a[j]) {
          p = 1;
          for (int k = j; k <= n; k += i) {
            p &= a[k];
          }
          if (p) {
            cout << "YES" << endl;
            return 0;
          }
        }
      }
    }
  }
  cout << "NO" << endl;
}
