#include <bits/stdc++.h>
using namespace std;
int a[100010], n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n / 3; i++) {
    if (n % i == 0) {
      for (int j = 1; j <= i; j++) {
        int temp = j;
        while (temp <= n && a[temp]) temp = temp + i;
        if (temp >= n) {
          printf("YES\n");
          return 0;
        }
      }
    }
  }
  printf("NO\n");
  return 0;
}
