#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long int n;
int a[N];
bool check(long long int k) {
  for (long long int i = 0; i < k; i++) {
    bool f = 1;
    for (long long int j = 0; i + j < n; j += k) {
      if (!a[i + j]) {
        f = 0;
        break;
      }
    }
    if (f) {
      return true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  bool f = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (!a[i]) {
      f = 0;
    }
  }
  if (f) {
    cout << "YES";
    return 0;
  }
  for (long long int i = 2; i * i <= n; i++) {
    if (i == n / 2) {
      continue;
    }
    if (n % i != 0) {
      continue;
    }
    if (check(i)) {
      cout << "YES";
      return 0;
    }
    if (i != 2) {
      if (check(n / i)) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
