#include <bits/stdc++.h>
using namespace std;
long long fast_power(long long val, long long deg, long long mod = 1000000007) {
  if (!deg) return 1 % mod;
  if (deg & 1) return fast_power(val, deg - 1, mod) * val % mod;
  long long res = fast_power(val, deg >> 1, mod);
  return (res * res) % mod;
}
long long MMI(long long a, long long mm = 1000000007) {
  return fast_power(a % mm, mm - 2, mm) % mm;
}
vector<long long> v;
long long visited[100010];
long long n, a[100010];
void divisors() {
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      if (n / i > 2) v.push_back(i);
      if (i > 2) v.push_back(n / i);
    }
  }
  cout << "\n";
  return;
}
bool check(long long gap) {
  memset(visited, 0, sizeof(visited));
  for (long long i = 0; i < n; i++) {
    long long cnt = 0;
    if (visited[i] == 0)
      for (long long j = i, cou = 0; cou < n / gap; j = (j + gap) % n, cou++) {
        visited[j] = 1;
        if (a[j] == 1) cnt++;
      }
    if (n / gap == cnt) return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  divisors();
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (auto &i : v) {
    if (check(i)) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
