n = int(input())
arr = list(map(int,input().split()))
pref = [0] * (n+1)

for i in range(n):
    pref[i+1] = pref[i]+arr[i]

vr = []
for i in range(0,n+1):
    for x in range(1,n+1):
        if pref[x+i] - pref[i] + pref[i] % (pref[n]//3) == 0:
            vr.append(x)

    if len(vr) == 3:
        break

print(0)
print(*vr)