#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, knight[100000];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &knight[i]);
  for (int i = 3; i <= n; i++) {
    if (n % i != 0) continue;
    bool lucky;
    for (int j = 0; j < n / i; j++) {
      lucky = true;
      for (int k = j; k < n; k += n / i) {
        if (knight[k] == 0) {
          lucky = false;
          break;
        }
      }
      if (lucky) break;
    }
    if (lucky) {
      printf("YES\n");
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}
