#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> pr;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      if (i > 2) {
        pr.push_back(i);
      }
      if (i != n / i && (n / i) > 2) {
        pr.push_back(n / i);
      }
    }
  }
  bool ch = false;
  for (int i = 0; i < pr.size(); i++) {
    for (int j = 0; j < n / pr[i]; j++) {
      int ss = 0;
      for (int k = j; k < n; k += (n / pr[i])) {
        ss += a[k];
      }
      if (ss == pr[i]) {
        ch = true;
        break;
      }
    }
    if (ch) break;
  }
  if (ch)
    cout << "YES";
  else
    cout << "NO";
}
