#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
bool compare(const long long &a, const long long &b) { return a > b; }
long long binpow(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 0) return binpow(a, b / 2) * binpow(a, b / 2);
  return a * binpow(a, b - 1);
}
void solve() {
  int n;
  cin >> n;
  short a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> factors{};
  for (int i = 3; i <= n; i++) {
    if (n % i == 0) factors.push_back(i);
  }
  bool found = false;
  for (int i = 0; i < factors.size(); i++) {
    for (int j = 0; j < n / factors[i]; j++) {
      short t = 1;
      for (int k = 0; k < n; k += (n / factors[i])) {
        t = t & a[j + k];
      }
      if (t == 1) {
        found = true;
        break;
      }
    }
    if (found) break;
  }
  found ? cout << "YES\n" : cout << "NO\n";
}
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  }
  int test_cases = 1;
  while (test_cases--) {
    solve();
  }
  return 0;
}
