#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100100];
int m;
int A[500];
void getDiv() {
  int sq = sqrt(n);
  A[1] = 1;
  m = 1;
  for (int i = 2; i <= sq; i++) {
    if (n % i == 0) {
      m++;
      A[m] = i;
      if (i * i == n || i == 2) continue;
      m++;
      A[m] = n / i;
    }
  }
}
int cal() {
  getDiv();
  sort(A + 1, A + m + 1);
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= A[i]; j++) {
      int u = j;
      int f = 0;
      int sum = 0;
      while (u <= n) {
        if (arr[u] != 1) {
          f = 1;
          break;
        }
        u += A[i];
        sum++;
      }
      if (f == 0 && sum >= 3) return 1;
    }
  }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  int uu = cal();
  if (uu == 1)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
