inf = open("parade.in", "r")
ouf = open("parade.out", "w")

n = int(inf.readline())
av = map(int, inf.readline().split())

index = 0
a = dict()
for x in av:
	a[index] = x
	index = index + 1

if all(map(lambda i: a[i - 1] < a[i], range(1, n))):
	ouf.write(str(n - 1) + "\n")
	for i in range(1, n):
		ouf.write(str(i) + " ")
	exit(0)

if all(map(lambda i: a[i - 1] > a[i], range(1, n))):
	ouf.write("1\n")
	ouf.write("1\n")
	exit(0)

inf = 10**10

u = dict()
v = dict()
uind = dict()
vind = dict()

u[0] = inf
v[0] = -inf

uind[0] = -1
vind[0] = -1

for i in range(1, n):
	u[i] = -inf
	uind[i] = -1

	if a[i] > a[i - 1]:
		u[i] = u[i - 1]
		uind[i] = uind[i - 1]

	if (a[i] > v[i - 1]) and (a[i - 1] > u[i]):
		u[i] = a[i - 1]
		uind[i] = i - 1

	v[i] = inf
	vind[i] = -1

	if a[i] < a[i - 1]:
		v[i] = v[i - 1]
		vind[i] = vind[i - 1]

	if (a[i] < u[i - 1]) and (a[i - 1] < v[i]):
		v[i] = a[i - 1]
		vind[i] = i - 1

#	print(str(i) + " " + str(u[i]) + " " + str(v[i]))


up = []

if u[n - 1] != -inf or v[n - 1] != inf:
	if u[n - 1] != -inf:
		lastUp = n - 1
		lastDn = uind[n - 1]
	else:
		lastDn = n - 1
		lastUp = vind[n - 1]

	while (lastUp >= 0) or (lastDn >= 0):
		if lastUp > lastDn:
			up = up + [lastUp]
			lastUp = lastUp - 1
			if lastUp != -1 and lastUp == lastDn:
				lastUp = vind[lastUp]
		else:
			lastDn = lastDn - 1
			if lastUp != -1 and lastUp == lastDn:
				lastDn = uind[lastDn]

	list.reverse(up)
	ouf.write(str(len(up)) + "\n")
	for x in up:
		ouf.write(str(x + 1) + " ")
else:
	ouf.write("Impossible\n")

