from bisect import bisect_left n = int(input()) A = list(map(int, input().split())) sumA = sum(A) accumA = [0] for i in range(n): accumA.append(accumA[-1] + A[i]) for i in range(n, 0, -1): if sumA % i != 0: continue res = sumA // i cnt = 0 idx = 0 pre_idx = 0 while pre_idx < n: idx = bisect_left(accumA, res + accumA[pre_idx]) if idx == n + 1 or accumA[idx] != res + accumA[pre_idx]: break cnt += 1 pre_idx = idx if cnt == i: print(i) exit()