import sys

n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))
f = sum(a)//3
a*=2
ans = []
for s in range(0, n-2):
    summ = [0,0,0]
    current_index = 0
    for x in range(s, s+n):
        if summ[current_index]+a[x]<f:
            summ[current_index]+=a[x]
        elif summ[current_index]+a[x]>f:
            break
        else:
            summ[current_index]+=a[x]
            if current_index == 0:
                ans.append(s+1)
                ans.append(x+2)
            elif current_index == 1:
                ans.append(x+2)
            current_index+=1
            if current_index>2:
                break
                
    if len(ans) == 3:
        break
    else:
        ans = []

if not len(ans) >= 3:
    print(max(a)-min(a))
    print(1,2,3)
else:
    print(0)
    for x in range(0, 3):
        print(ans[x], end = " ")