#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
  if (b == 0) return 1;
  long long int p = power(a, b / 2);
  if (b % 2 == 0)
    return p * p;
  else
    return a * p * p;
}
long int gcd(long int a, long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  long long int n, i, j, k, c = 0;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long int> fac;
  for (i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (i > 2) fac.push_back(i);
      if (n != i * i) fac.push_back(n / i);
    }
  }
  for (i = 0; i < fac.size(); i++) {
    for (j = 0; j < n / fac[i]; j++) {
      c = 0;
      for (k = j; k < n; k += n / fac[i]) {
        if (a[k] != 1)
          break;
        else
          c++;
      }
      if (c == fac[i]) break;
    }
    if (j != n / fac[i]) break;
  }
  if (i != fac.size())
    cout << "YES";
  else
    cout << "NO";
}
