while True:
    try:
        n = int(input())
        a = list(map(int, input().split()))
        pear = []
        if a[0] != a[1]:
            pear.append(0)


        for i in range(1,n-1):
            if a[i] > a[i-1] and a[i] > a[i+1]:
                pear.append(i)
            elif a[i] < a[i-1] and a[i] < a[i+1]:
                pear.append(i)
            else:
                continue
        if a[-1] != a[-2]:
            pear.append(n-1)
        pear = list(map(str, pear))
        res = ' '.join(pear)
        print(res)
    except:
        break