#include <bits/stdc++.h>
using namespace std;
int arr[100001];
int main() {
  int n, i, be, len, num, k, t;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  for (len = n / 3; len > 0; len--) {
    if (n % len != 0) continue;
    t = n / len;
    for (i = 0; i < n; i++) {
      num = t;
      k = i;
      while (num > 0) {
        if (arr[k] == 1) {
          k = (k + len) % n;
          num--;
        } else
          break;
      }
      if (num == 0) {
        printf("YES\n");
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
