#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int m = n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> v;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (i > 2) v.push_back(i);
      if ((n / i) != i && (n / i) > 2) v.push_back(n / i);
    }
  }
  if (v.size() == 0)
    cout << "NO";
  else {
    int f = 1;
    for (int i = 0; i < v.size(); i++) {
      int temp = v[i];
      int x = m / temp;
      int c = 0;
      for (int start = 0; start < x; start++) {
        for (int j = start; j < m; j += x) {
          c += a[j];
        }
        if (c == temp) {
          f = 0;
          break;
        }
        c = 0;
      }
      if (f == 0) break;
    }
    if (f == 0)
      cout << "YES";
    else
      cout << "NO";
  }
  return 0;
}
