N = int(input())
train = list(map(int, input().split(' ')))

for i in range(N):
    aku = 0
    count = 0
    possible = False
    for j in range(N-i):
        aku += train[i+j]
        count += 1
        if aku % 10 == 0:
            print(count, " ")
            possible = True
            break
    if not possible:
        print(-1, " ")
            
