#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int N, A[MAXN];
bool flag[MAXN];
bool check(int n) {
  if (n < 3) return false;
  int d = N / n;
  for (int i = 0; i < d; ++i) flag[i] = true;
  for (int i = 1; i <= N; ++i)
    if (!A[i]) flag[i % d] = false;
  for (int i = 0; i < d; ++i)
    if (flag[i]) return true;
  return false;
}
int main() {
  cin >> N;
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
  for (int i = 1; i * i <= N; ++i)
    if (N % i == 0) {
      if (check(i)) {
        printf("YES\n");
        return 0;
      }
      if (check(N / i)) {
        printf("YES\n");
        return 0;
      }
    }
  printf("NO\n");
  return 0;
}
