n = int(input())
a = list(map(int,input().split()))

# O(n^2) = 2/3 * n<10^6

prefix_sum = [0 for _ in range(n)]
prefix_sum[0]=a[0]
for i in range(1,n):
    prefix_sum[i] = prefix_sum[i-1]+a[i]

ave = prefix_sum[-1]//3 # revivus



xg,yg,zg = 0,0,0
xs,ys,zs = 0,0,0
res = False

for xstart in range(0,n-2):
    for ystart in range(xstart+1,n-1):
        for zstart in range(ystart+1,n-1): # ystart = x
            #if(xstart==1 and ystart==2 and zstart==5):
            #    print("sluch")
            #print(xstart,ystart,zstart, '-', prefix_sum[ystart-1]-prefix_sum[xstart-1], prefix_sum[zstart-1]-prefix_sum[ystart-1],prefix_sum[-1]+prefix_sum[xstart-1]-prefix_sum[zstart-1])
            xs,ys,zs = prefix_sum[ystart-1]-prefix_sum[xstart-1], prefix_sum[zstart-1]-prefix_sum[ystart-1],prefix_sum[-1]-prefix_sum[zstart-1]+prefix_sum[xstart-1]
            if(xs==ys==zs):
                print(0)
                print(xstart+1,ystart+1,zstart+1)