N = int(input()) A = [int(a) for a in input().split()] SUM = sum(A) i = max(A) while i <= SUM: if SUM%i > 0: i += 1 continue cnt = 0 for j in range(N): if cnt < i: cnt += A[j] elif cnt == i: cnt = A[j] else: cnt = 0 break if cnt == i: print(SUM//i) break i += 1