#include <bits/stdc++.h>
using namespace std;
int kt[100001];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, num;
  cin >> n;
  for (long long i = 1; i < n + 1; i++) cin >> kt[i];
  for (long long i = 3; i < n + 1; i++) {
    if (n % i == 0) {
      for (int j = 1; j <= n / i; j++) {
        num = 0;
        for (int k = j; k <= n; k += (n / i))
          if (!kt[k]) {
            num = 1;
            break;
          }
        if (!num) return cout << "YES", 0;
      }
    }
  }
  return cout << "NO", 0;
}
