#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  bool flag = false;
  vector<int> b;
  for (int p = 3; p < n + 1; p++) {
    if (n % p == 0) {
      b.resize(n / p);
      for (int i = 0; i < n / p; i++) {
        b[i] = 0;
        for (int j = 0; j < p; j++) b[i] = b[i] + a[i + j * (n / p)];
      }
      sort(b.begin(), b.end());
      if (b[(n / p) - 1] == p) {
        flag = true;
        break;
      }
    }
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
