import sys

n, *a = map(int, sys.stdin.read().split())

number_of_ones = a.count(1)
if n == 3 or number_of_ones == 0:
    print(max(a) - min(a))
    print(1, 2, 3)
    exit()

magic_number = (number_of_ones-2)//3+1
first_one = a.index(1)
x = first_one + 1

next_one = first_one
for _ in range(magic_number):
    next_one = a.index(1, next_one + 1)
y = next_one + 1

next_next_one = next_one
for _ in range(magic_number-1):
    next_next_one = a.index(1, next_next_one + 1)
z = next_next_one + 2

print(number_of_ones%3)
print(x, y, z)