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: # 作られる数列の要素 for x in range(b+b, tot, b): if x not in st: break else: print(tot // b) exit() print(1)