1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import sys
#import datetime

def lucynka():
    danie = sys.stdin
    #danie = open("danie.txt", "r")
    #danie.readline()
    danie.readline()
    line = danie.readline().rstrip("\n").rstrip("\r")
    #print(line)

    bur = []
    for znak in line.split():
        bur.append(int(znak))
    
    lenn = len(bur)

    suma = sum(bur)


    bur.append(-1)
    
    dlug = lenn
    while(dlug > 1):
        if suma % dlug != 0:
            dlug -= 1
            continue
        
        copy = bur.copy()
        pos = 0
        while True:
        #for pos in range(lenn):
            if copy[pos] > 0:
                if pos + dlug > lenn:
                    break
                
                waves = copy[pos]
                
                for i in range(dlug):
                    copy[pos + i] -= waves
                    #if copy[pos + i] < 0:
                    #    pos = lenn + 10
                    #    break
            elif copy[pos] < 0:
                break
            
            pos += 1
        if pos == lenn:
            return dlug
            
        
          
        dlug -= 1
    return 1        


#start = datetime.datetime.now()
print(lucynka())
#print(datetime.datetime.now() - start)