#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  for (long long i = 3; i <= n; i++) {
    if (isPrime(i) == false and i != 4) continue;
    if (n % i != 0) continue;
    for (long long j = 0; j < n / i; j++) {
      long long count = 0;
      for (long long k = j; k < n; k += n / i) {
        if (arr[k] == 1) {
          count++;
        }
      }
      if (count == i) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
