#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << "[" << *it << ": " << a << "]\t";
  err(++it, args...);
}
const long long nax = 1e5 + 5;
long long a[nax];
long long n;
bool count(long long k) {
  if (n / k <= 2) return false;
  bool arr[k];
  memset(arr, true, sizeof(arr));
  for (long long i = 0; i < n; i++) {
    if (a[i] == 0) {
      arr[i % k] = false;
    }
  }
  for (long long i = 0; i < k; i++)
    if (arr[i]) return true;
  return false;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  bool ok = false;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i != 0) continue;
    ok = ok | count(i);
    ok = ok | count(n / i);
    if (ok) break;
  }
  cout << (ok ? "YES" : "NO") << '\n';
  ;
  return 0;
}
