from itertools import accumulate N = int(input()) A = list(map(int, input().split())) acc = list(accumulate(A)) tot = sum(A) st = set(acc) for b in acc: # 作られる数列の要素 if tot % b != 0: continue for x in range(b+b, tot, b): if x not in st: break else: print(tot // b) exit() print(1)