#!/usr/bin/ruby
n,*a=$<.read.split.map &:to_i
X=10**9+3
Y=10**9+7
#h1=Hash.new 0
#h2=Hash.new 0
h1=h2=0
puts (1..n).select{|i|
	#h1[a[i-1]]+=1
	#h2[a[n-i]]+=1
	h1=(h1*X+a[i-1])%Y
	h2=(h2*X+a[n-i])%Y
	h1==h2
}*' '

