#include <bits/stdc++.h>
using namespace std;
int prime[100005];
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  prime[0] = prime[1] = prime[2] = 1;
  for (int i = 0; i < 1000; i++) {
    if (prime[i] == 0) {
      for (int j = 2 * i; j < 100005; j += i) prime[j] = 1;
    }
  }
  prime[4] = 0;
  bool flag, ans = false;
  for (int i = 3; i <= n; i++) {
    if (!prime[i] && (n % i == 0)) {
      int jump = n / i;
      for (int j = 0; j < jump; j++) {
        flag = true;
        for (int k = j; k < n; k += jump) {
          if (arr[k] == 0) {
            flag = false;
            break;
          }
        }
        if (flag) {
          ans = true;
          break;
        }
      }
    }
    if (ans) break;
  }
  if (ans)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
