#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  bool found = false;
  for (int sides = 3; sides <= n; sides++) {
    if (found) break;
    if (n % sides == 0) {
      int len = n / sides;
      for (int j = 0; j < n; j++) {
        int temp = j;
        if (A[temp] == 0)
          ;
        else {
          int u;
          for (u = 1; u <= sides; u++) {
            temp = (temp + len) % n;
            if (A[temp] == 0) {
              break;
            }
          }
          if (u == sides + 1 && temp == j) {
            found = true;
            break;
          }
        }
      }
    }
  }
  if (found)
    cout << "YES";
  else
    cout << "NO";
  cin >> n;
}
