# Arup Guha
# 2/24/2024
# Solution to SER D1/D2 Problem D: Ordered Problem Set

# Get # of problems.
n = int(input())

# Read list.
nums = []
for i in range(n):
    x = int(input())
    nums.append(x)

# Store answers here.
res = []

# Try each number of groups.
for i in range(2,n+1):

    # Can't work.
    if n%i != 0:
        continue

    prevmax = -1
    flag = True

    # Go through each sublist.
    for j in range(0,n,n//i):

        # Easy in python to isolate this sublist.
        tmp = nums[j:j+n//i]

        # This is all we need.
        x = min(tmp)
        y = max(tmp)

        # Order violated.
        if x <= prevmax:
            flag = False

        # Update this for the next round.
        prevmax = y

    # If it worked, add to the list.
    if flag:
        res.append(i)

# No solutions.
if len(res) == 0:
    print(-1)

# Output all solutions.
else:
    for x in res:
        print(x)
        
