#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int bsearch(int l, int h, int a[], int key) {
  int m = (l + h) / 2;
  int ans = -1;
  while (l <= h) {
    if (a[m] == key) {
      ans = m;
      break;
    } else if (a[m] < key)
      l = m + 1;
    else
      h = m - 1;
  }
  return ans;
}
long long bin(long long a, long long b, long long m) {
  a = a % m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b = b >> 1;
  }
  return res;
}
int ncr(int n, int r) {
  long long res = 1;
  for (int i = 0; i < r; i++) {
    res = res * (n - i);
    res = res / (i + 1);
  }
  return res;
}
int find(int i, vector<int> p) {
  while (p[i] != i) i = p[i];
  return i;
}
void join(int u, int v, vector<int>& p) {
  int x = find(u, p);
  int y = find(v, p);
  p[x] = p[y];
}
int check(int m, int a[], int n) {
  for (int i = 0; i < m; i++) {
    bool flag = 1;
    for (int k = i; k < n; k += m) {
      if (a[k] == 0) {
        flag = 0;
      }
    }
    if (flag) return 1;
  }
  return 0;
}
int32_t main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i <= n / 3; i++) {
    if ((n % i == 0) && (n / i >= 3) && check(i, a, n)) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
