#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 3; i <= n; i++) {
    if (n % i == 0) {
      for (int k = 0; k < n / i; k++) {
        int sum = 0;
        for (int j = k; j < n; j += n / i) {
          if (a[j] == 1) sum++;
        }
        if (sum == i) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
}
