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

suma = sum(a)
if sum(a) % 3 == 0:
    print(0)
    res = (suma - suma % 3) // 3
else:
    print(1)
    res = (suma - suma % 3) // 3 + 1
rez = 0
resy = res
resypr = 0
while rez < res:
    # print("----")
    # print(rez)
    # print(resy)
    s=sum(a[resypr:resy])
    rez += s
    resypr=resy
    resy += res-rez
rez = 0
resz = resy+res
reszpr=resy
while rez < res:
    s = sum(a[reszpr:resz])
    rez += s
    reszpr = resz
    resz += res - rez
# print(3 - suma % 3)
print(1, resy + 1, resz + 1)
