#include <bits/stdc++.h>
using namespace std;
int arr[100001];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int flag = 0;
  int cnt;
  for (int i = 0; i < n; i++) {
    while (arr[i] != 1) i++;
    for (int d = 1; d <= n / 3; d++) {
      if (n % d != 0) continue;
      cnt = 1;
      for (int k = i + d;; k = (k + d) % n) {
        if (arr[k] != 1)
          break;
        else if (k == i) {
          if (cnt > 2) flag = 1;
          break;
        }
        cnt++;
      }
      if (flag == 1 && cnt > 2) {
        break;
      }
    }
    if (flag == 1 && cnt > 2) {
      break;
    }
  }
  if (flag == 1 && cnt > 2)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
