if n % 2 == 0: primes.append(2) while n % 2 == 0: n /= 2
for i inrange(3,int(sqrt(n)+1),2): if n % i == 0: primes.append(int(i)) while n % i == 0: n /= i if n > 2: primes.append(int(n))
return primes
n = int(input()) point = list(map(int,input().split())) sum_one = sum(point) flag = 0 flag2 = 0
primes = getprimes(n) #存储n的素因子
#找正s边形,s为n的素因子 for i in primes: if i == 2: continue if i > sum_one: break for j inrange(n): j2 = j t = n / i #正多边形顶点坐标的间隔 flag == 0#符合正多边形的顶点的数量 if point[j2%n] == 1: flag += 1 while flag < i: j2 = int((j2+t) % n) if point[j2] == 1: flag += 1 else: break if flag == i: print('YES') flag2 = 1 break if flag2: break