#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long M = 1e6 + 5;
const long long mod = 1e9 + 7;
long long a[N], cnt;
vector<long long> prime;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  long long m = n;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  while ((m & 1) == 0) m >>= 1, cnt++;
  if (cnt >= 2) prime.push_back(4);
  for (long long i = 3; i * i <= n; ++i) {
    if (m % i == 0) prime.push_back(i);
    while (m % i == 0) m = m / i;
  }
  if (m > 1) prime.push_back(m);
  for (long long i : prime) {
    long long d = n / i;
    for (long long j = 0; j < d; ++j) {
      long long s = 0;
      for (long long k = j; k < n; k += d) s += a[k];
      if (s == i) return cout << "YES", 0;
    }
  }
  cout << "NO";
}
