Bajtek, known for his unusual gifts, recently got an integer array $x_0, x_1, \ldots, x_{k-1}$.

Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. After hours spent on searching for a new toy, Bajtek found on the arrays producer's website another array $a$ of length $n + 1$. As a formal description of $a$ says, $a_0 = 0$ and for all other $i$ ($1 \le i \le n$) $a_i = x_{(i-1)\bmod k} + a_{i-1}$, where $p \bmod q$ denotes the remainder of division $p$ by $q$.

For example, if the $x = [1, 2, 3]$ and $n = 5$, then:  $a_0 = 0$,  $a_1 = x_{0\bmod 3}+a_0=x_0+0=1$,  $a_2 = x_{1\bmod 3}+a_1=x_1+1=3$,  $a_3 = x_{2\bmod 3}+a_2=x_2+3=6$,  $a_4 = x_{3\bmod 3}+a_3=x_0+6=7$,  $a_5 = x_{4\bmod 3}+a_4=x_1+7=9$. 

So, if the $x = [1, 2, 3]$ and $n = 5$, then $a = [0, 1, 3, 6, 7, 9]$.

Now the boy hopes that he will be able to restore $x$ from $a$! Knowing that $1 \le k \le n$, help him and find all possible values of $k$ — possible lengths of the lost array.


-----Input-----

The first line contains exactly one integer $n$ ($1 \le n \le 1000$) — the length of the array $a$, excluding the element $a_0$.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^6$).

Note that $a_0$ is always $0$ and is not given in the input.


-----Output-----

The first line of the output should contain one integer $l$ denoting the number of correct lengths of the lost array.

The second line of the output should contain $l$ integers — possible lengths of the lost array in increasing order.


-----Examples-----
Input
5
1 2 3 4 5

Output
5
1 2 3 4 5 
Input
5
1 3 5 6 8

Output
2
3 5 
Input
3
1 5 3

Output
1
3 


-----Note-----

In the first example, any $k$ is suitable, since $a$ is an arithmetic progression.

Possible arrays $x$:  $[1]$ $[1, 1]$ $[1, 1, 1]$ $[1, 1, 1, 1]$  $[1, 1, 1, 1, 1]$

In the second example, Bajtek's array can have three or five elements.

Possible arrays $x$:  $[1, 2, 2]$ $[1, 2, 2, 1, 2]$

For example, $k = 4$ is bad, since it leads to $6 + x_0 = 8$ and $0 + x_0 = 1$, which is an obvious contradiction.

In the third example, only $k = n$ is good.

Array $[1, 4, -2]$ satisfies the requirements.

Note that $x_i$ may be negative.

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
n = int(input())
a = list(map(int, input().split()))
diff = [a[0]]
for i in range(n - 1):
	diff.append(a[i + 1] - a[i])
out = ''
count = 0
for i in range(1, n + 1):
	good = True
	for j in range(n - i):
		if diff[j] != diff[j + i]:
			good = False
	if good:
		count += 1
		out += str(i) + ' '
print(count)
print(out[:-1])


def check(a, k):
	for i in range(k, len(a)):
		if a[i] != a[i - k]:
			return False
	return True

def solve(a):
	n = len(a)
	b = []
	for i in range(n):
		t = a[i]
		if i:
			t -= a[i - 1]
		b += [t]
	res = []
	for i in range(1, n + 1):
		if check(b, i):
			res += [i]
	return res
n = int(input())
a = map(int, input().split())
a = list(a)
res = solve(a)
print(len(res))
print(' '.join(map(str, res)))


n = int(input())
a = [int(i) for i in input().split()]
c = [0]
for el in a:
	c.append(el)
for i in range(n):
	a[i] -= c[i]
r = []
for k in range(1, n + 1):
	q = a[:]
	if n % k != 0:
		x = k - n % k
		for i in range(x):
			q.append('@')
		h = n + x
	else:
		h = n
	v = h // k
	w = h // v
	f = True
	for i in range(w):
		p = q[i]
		for j in range(1, v):
			if q[j * w + i] != p and q[j * w + i] != '@':
				f = False
				break
	if f:
		r.append(k)
print(len(r))
print(*r)


n = int(input()) + 1
a = [0] + list(map(int, input().split()))
b = [a[i] - a[i - 1] for i in range(1, n)]
c = []
for k in range(1, n):
	for j in range(k):
		z = 0
		for l in range(j, n - 1, k):
			if b[l] != b[j]:
				z = 1
				break
		if z:
			break
	else:
		c.append(k)
print(len(c))
print(*c)


n = int(input())
A = list(map(int, input().split()))
X = [A[0]]
for i in range(0, n - 1):
	X.append(A[i + 1] - A[i])
Ans = []
for d in range(1, n + 1):
	for i in range(n - d):
		if i + d <= n:
			if X[i] != X[i + d]:
				break
	else:
		Ans.append(d)
print(len(Ans))
print(*Ans)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
n = val()
l = [0] + li()
ans = []

def makearray(w):
	global l, n
	l1 = []
	for i in range(1, w + 1):
		l1.append(l[i] - l[i - 1])
	return l1[:]
for i in range(1, n + 1):
	curraray = makearray(i)
	addcurr = 1
	for j in range(1, n + 1):
		if l[j] - l[j - 1] != curraray[(j - 1) % i]:
			addcurr = 0
			break
	if addcurr:
		ans.append(i)
print(len(ans))
print(*ans)


n = int(input())
arr = list(map(int, input().split()))
ans = []
arrr = []
for i in range(n):
	if i == 0:
		arrr.append(arr[i])
	else:
		arrr.append(arr[i] - arr[i - 1])
for i in range(1, n, 1):
	if arrr[i:n] == arrr[0:n - i]:
		ans.append(i)
ans.append(n)
print(len(ans))
print(*ans)


n = int(input())
l = list(map(int, input().split()))
l1 = [l[0]]
for i in range(1, n):
	l1.append(l[i] - l[i - 1])
otv = []
for i in range(1, n + 1):
	for j in range(n - 1, -1, -1):
		if j - i < 0:
			otv.append(i)
			break
		if l1[j] != l1[j - i]:
			break
print(len(otv))
print(*otv)


n = int(input())
a = list(map(int, input().split()))
diffs = [a[0]]
for i in range(1, n):
	diffs.append(a[i] - a[i - 1])
output = []
for l in range(1, n + 1):
	flag = True
	for i in range(l, n):
		if diffs[i] != diffs[i - l]:
			flag = False
			break
	if flag:
		output.append(l)
print(len(output))
for i in output:
	print(i, end=' ')


n = int(input())
b = list(map(int, input().split()))
a = [0]
for i in range(n):
	a.append(b[i])
count = 0
mlist = []
for k in range(1, n + 1):
	x = n // k
	l = [0] * k
	temp = [0] * k
	for i in range(1, n + 1):
		y = (i - 1) % k
		done = 0
		if i <= k:
			l[y] = a[i] - a[i - 1]
			temp[y] = a[i] - a[i - 1]
		else:
			temp[y] = a[i] - a[i - 1]
			if temp[y] != l[y]:
				done = 1
				break
	if done == 0:
		count += 1
		mlist.append(k)
print(count)
for i in range(len(mlist)):
	if i == n - 1:
		print(mlist[i])
	else:
		print(mlist[i], end=' ')


n = int(input())
a = list(map(int, input().split()))
for i in range(n - 1, 0, -1):
	a[i] -= a[i - 1]
ans = []
for i in range(1, n):
	f = True
	for j in range(i, n):
		if a[j] != a[j - i]:
			f = False
			break
	if f:
		ans.append(i)
ans.append(n)
print(len(ans))
print(' '.join(list(map(str, ans))))


import math
amount = int(input())
amount += 1
array = [int(s) for s in input().split()]
diffs = []
diffs.append(array[0])
for i in range(len(array) - 1):
	diffs.append(array[i + 1] - array[i])

def is_contains(array_1, array_2):
	for i in range(len(array_1)):
		if array_1[i] != array_2[i]:
			return False
	return True
result = []
for i in range(1, len(diffs) + 1):
	kek = diffs[:i]
	if is_contains(diffs, kek * math.ceil(len(diffs) / i)):
		result.append(i)
print(len(result))
print(' '.join([str(i) for i in result]))


n = int(input())
x = list(map(int, input().split()))
y = [x[0]]
i = 1
while i < n:
	y += [x[i] - x[i - 1]]
	i += 1
i = 1
z = []
while i <= 1000 and i <= n:
	if y == y[:i] * (n // i) + y[:n % i]:
		z += [i]
	i += 1
print(len(z))
for i in z:
	print(i, end=' ')


n = int(input())
l = [0] + [*map(int, input().split())]
x = [l[i] - l[i - 1] for i in range(1, n + 1)]
res = []
for k in range(1, n + 1):
	accept = True
	for i in range(k):
		for j in range(i, n, k):
			if x[j] != x[i]:
				accept = False
				break
		if not accept:
			break
	if accept:
		res.append(str(k))
print(len(res))
print(' '.join(res))


n = int(input())
a = [0, *map(int, input().split())]
d = [y - x for (x, y) in zip(a, a[1:])]
r = [i for i in range(1, n + 1) if d[i:] == d[:-i]]
print(len(r))
print(*r)


def check_k(k, a, x, n):
	for i in range(k, n + 1):
		num = a[i] - a[i - 1]
		index = (i - 1) % k
		if x[index] == None:
			x[index] = num
		elif x[index] == num:
			continue
		else:
			return False
	return True

def main():
	n = int(input())
	a = [0] + [int(i) for i in input().split()]
	tot = 0
	res = ''
	x = []
	for k in range(1, n + 1):
		x.append(None)
		if check_k(k, a, x, n):
			tot += 1
			res += str(k) + ' '
	print(str(tot))
	print(res)
main()


n = int(input())
l = list(map(int, input().split()))
arr = [l[0]]
for i in range(1, n):
	arr.append(l[i] - l[i - 1])
num = 0
l = []
for i in range(1, n + 1):
	boo = True
	for k in range(i):
		val = arr[k]
		for j in range(0, n, i):
			if j + k < n and val != arr[j + k]:
				boo = False
				break
		if not boo:
			break
	if boo:
		l.append(i)
print(len(l))
print(*l)


from sys import stdin, stdout
from math import sqrt
import math
import heapq
from itertools import accumulate
N = int(input())
arr = [int(x) for x in stdin.readline().split()]
ans = []
for k in range(1, N + 1):
	tmp = [0] * k
	flag = 0
	for i in range(N):
		if i == 0:
			d = arr[i]
		else:
			d = arr[i] - arr[i - 1]
		if i < k:
			tmp[i] = d
		elif tmp[i % k] != d:
			flag = 1
			break
	if flag == 0:
		ans.append(k)
print(len(ans))
print(*ans)


n = int(input())
a = [0] + list(map(int, input().split()))
Lens = []
for k in range(1, n + 1):
	t = 1
	x = []
	while t <= k:
		x.append(a[t] - a[t - 1])
		t += 1
	for i in range(1, n + 1):
		if a[i] != a[i - 1] + x[(i - 1) % k]:
			break
	else:
		Lens.append(k)
print(len(Lens))
print(*Lens)


import math
n = int(input())
a = list(map(int, input().strip().split()))
a = [0] + a
used = []
for i in range(n):
	used.append(a[i + 1] - a[i])
true_k = []
for k in range(1, n + 1):
	counter = 0
	for i in range(n):
		if used[i % k] == used[i]:
			counter += 1
		else:
			break
	if counter == n:
		true_k.append(k)
print(len(true_k))
print(*true_k)


def work(j, a):
	N = len(a)
	for i in range(0, N):
		if a[i] != a[i % j]:
			return False
	return True
n = int(input())
a = [int(e) for e in input().split()]
for i in range(1, n)[::-1]:
	a[i] = a[i] - a[i - 1]
ans = []
for i in range(1, n + 1):
	if work(i, a):
		ans.append(i)
print(len(ans))
print(' '.join((str(e) for e in ans)))


t = 1
for q in range(t):
	n = int(input())
	ch = input()
	L = [int(i) for i in ch.split()]
	L2 = [n]
	L3 = [L[0]]
	for i in range(1, n):
		L3.append(L[i] - L[i - 1])
	for k in range(1, n):
		test = True
		for i in range(n - k):
			if L3[i] != L3[i + k]:
				test = False
		if test:
			L2.append(k)
	L2.sort()
	print(len(L2))
	s = ''
	for i in L2:
		s += str(i) + ' '
	print(s)


n = int(input())
a = [*map(int, input().split())]
i = n - 1
while i:
	a[i] -= a[i - 1]
	i -= 1
r = [i for i in range(1, n + 1) if a[i:] == a[:-i]]
print(len(r))
print(*r)


n = int(input())
l = [int(i) for i in input().split()]
intl = l[0]
cd = [0] * n
cd[0] = l[0]
for i in range(1, n):
	cd[i] = l[i] - l[i - 1]
f = 0
ans = []
cnt = 0
import math as m
l = cd[:]
for i in range(1, n + 1):
	x = l[0:i] * (n // i) + l[0:n % i]
	y = l[0:n]
	if x == y:
		cnt += 1
		ans.append(i)
print(cnt)
print(*ans)


n = int(input())
x = 0
a = []
for y in map(int, input().split()):
	a += (y - x,)
	x = y
f = [-1] * (n + 1)
for i in range(1, n + 1):
	f[i] = f[i - 1] + 1
	while f[i] > 0 and a[i - 1] != a[f[i] - 1]:
		f[i] = f[f[i] - 1] + 1
b = []
i = n
while i > 0:
	b += (n - f[i],)
	i = f[i]
print(len(b))
print(' '.join(map(str, b)))


n = int(input())
a = [int(s) for s in input().split()]
d = []
d.append(a[0])
for i in range(1, n):
	d.append(a[i] - a[i - 1])
ans = []
for i in range(1, n):
	poss = True
	for j in range(i, n):
		if d[j % i] != d[j]:
			poss = False
			break
	if poss:
		ans.append(i)
ans.append(n)
print(len(ans))
print(*ans)


n = int(input())
a = [0] + [int(i) for i in input().split()]
b = [0] * n
ans = []
for i in range(1, len(a)):
	b[i - 1] = a[i] - a[i - 1]
for i in range(1, n):
	if b[:i] == b[n - i:]:
		ans.append(n - i)
print(len(ans) + 1)
print(*sorted(ans), n)


n = int(input())
l = list(map(int, input().split()))
k = [l[0]]
for t in range(1, n):
	k.append(l[t] - l[t - 1])
ans = []
for t in range(1, n + 1):
	if k[t:] == k[:-t]:
		ans.append(t)
print(len(ans))
print(*ans)


n = int(input())
a = [0]
a += list(map(int, input().split()))
x = []
for i in range(1, n + 1):
	x.append(a[i] - a[i - 1])
ans = []
b = a[1:]
for i in range(1, n + 1):
	r = n % i
	c = x[:i]
	f = 0
	if x[:r] != x[n - r:]:
		continue
	for j in range(i, n - r, i):
		if x[j:j + i] != c:
			f = 1
	if f == 0:
		ans.append(i)
print(len(ans))
print(*ans)


n = int(input())
arr = [int(x) for x in input().split()]
arr = [0] + arr
gap = []
pat = []
for i in range(1, len(arr)):
	gap.append(arr[i] - arr[i - 1])
for l in range(1, len(arr)):
	last = True
	for i in range(0, len(arr) - l - 1):
		if gap[i] != gap[i + l]:
			last = False
	if last:
		pat.append(l)
print(len(pat))
for x in pat:
	print(x, end=' ')


def valid(array, r):
	n = len(array)
	is_valid = True
	for i in range(r):
		j = i + r
		while j < n:
			if array[i] != array[j]:
				is_valid = False
			j += r
	return is_valid
n = int(input())
aa = [int(x) for x in input().split()]
a = [aa[0]]
for i in range(1, n):
	a.append(aa[i] - aa[i - 1])
res = []
for k in range(1, n + 1):
	if valid(a, k):
		res.append(k)
print(len(res))
print(' '.join(map(str, res)))


n = int(input())
a = [0] + list(map(int, input().split(' ')))
d = []
for i in range(1, n + 1):
	x = [-1000000000 for j in range(i)]
	c = 1
	for j in range(1, n + 1):
		if x[(j - 1) % i] == -1000000000:
			x[(j - 1) % i] = a[j] - a[j - 1]
		elif x[(j - 1) % i] == a[j] - a[j - 1]:
			pass
		else:
			c = 0
			break
	if c == 1:
		d.append(i)
print(len(d))
print(*d)


n = int(input())
a = [int(i) for i in input().split()]
x = [a[0]]
k = [1]
for i in range(1, n):
	ai = a[i]
	aii = a[i - 1]
	for j in range(len(k) - 1, -1, -1):
		if aii + x[i % k[j]] != ai:
			del k[j]
	x.append(ai - aii)
	k.append(i + 1)
print(len(k))
print(' '.join(map(str, k)))


ar = [0]
n = int(input())
ls = list(map(int, input().split()))
for i in range(n):
	ar.append(ls[i])
possible = [True] * n
ar2 = []
for i in range(1, n + 1):
	val = ar[i] - ar[i - 1]
	ar2.append(val)
for i in range(1, n + 1):
	temp = [None] * i
	for j in range(n):
		if temp[j % i] is None or temp[j % i] == ar2[j]:
			temp[j % i] = ar2[j]
		else:
			possible[i - 1] = False
			break
s = ''
cnt = 0
for i in range(n):
	if possible[i]:
		cnt += 1
		s += f'{i + 1} '
print(cnt)
print(s)


n = int(input())
a = list(map(int, input().split(' ')))
for i in range(n - 1, 0, -1):
	a[i] -= a[i - 1]

def solve(x):
	suf = a[:x]
	j = x
	while j < n:
		for i in range(x):
			if j + i >= n:
				return True
			elif suf[i] != a[i + j]:
				return False
		j += x
	return True
solution = []
for i in range(1, n + 1):
	if solve(i):
		solution.append(str(i))
print(len(solution))
print(' '.join(solution))


n = int(input())
l = list(map(int, input().split()))
k = 1
c = 0
ans = []
for i in range(n):
	y = 0
	x = []
	for j in range(k):
		x.append(l[j] - y)
		y = l[j]
	o = 0
	fl = 1
	for p in range(k, n):
		if l[p] - l[p - 1] != x[o % k]:
			fl = 0
			break
		o += 1
	if fl:
		c += 1
		ans.append(k)
	k += 1
print(c)
for i in ans:
	print(i, end=' ')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	b = [a[0]]
	for i in range(1, n):
		b.append(a[i] - a[i - 1])
	results = []
	for k in range(1, n + 1):
		if (b[:k] * ((n + k - 1) // k))[:n] == b:
			results.append(k)
	print(len(results))
	print(*results, sep=' ')
main()


def main():
	n = int(input())
	array = [0] + [int(c) for c in input().split()]
	rec_x = [array[i + 1] - array[i] for i in range(n)]
	res = []
	for k in range(1, n + 1):
		if (rec_x[:k] * (n // k + 1))[:n] == rec_x:
			res.append(str(k))
	print(len(res))
	print(' '.join(res))
main()


n = int(input())
data = [0] + [int(x) for x in input().strip().split(' ')]
res = []
X = [0 for _ in range(n)]
for i in range(1, n + 1):
	X[i - 1] = data[i] - data[i - 1]
for k in range(1, n + 1):
	f = True
	for i in range(1, n + 1):
		if data[i] != X[(i - 1) % k] + data[i - 1]:
			f = False
			break
	if f:
		res.append(k)
print(len(res))
print(' '.join([str(x) for x in res]))


n = int(input().strip())
a = list(map(int, input().strip().split()))
b = [0]
b.extend(a)
diff = [b[i] - b[i - 1] for i in range(1, n + 1)]
ans = []
for possible_k in range(1, n + 1):
	flag = True
	mark = [False for i in range(n)]
	for l in range(0, n):
		to_check = diff[l]
		if mark[l] == False:
			mark[l] = True
			for j in range(l, n, possible_k):
				if diff[j] != to_check:
					flag = False
					break
				mark[j] = True
			if flag is False:
				break
	if flag:
		ans.append(possible_k)
print(len(ans))
print(' '.join(map(str, ans)))


def inint():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def check(a, sa, k):
	i = 0
	for j in a:
		if sa[i % k] != j:
			return True
		i += 1
	return False

def main():
	n = inint()
	aa = [0] + inlist()
	a = [aa[i] - aa[i - 1] for i in range(1, n + 1)]
	ans = []
	for i in range(n):
		chk = 0
		for j in range(i + 1, n):
			if a[j] != a[j % (i + 1)]:
				chk = 1
				break
		if chk == 0:
			ans.append(i + 1)
	print(len(ans))
	print(*ans)
main()


gcd = lambda a, b: gcd(b, a % b) if b else a

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	brr = []
	for i in range(len(arr) - 1, 0, -1):
		arr[i] -= arr[i - 1]
	for i in range(1, len(arr) + 1):
		f = 1
		for j in range(0, i):
			for k in range(j + i, len(arr), i):
				if arr[j] != arr[k]:
					f = 0
					break
		if f:
			brr.append(i)
	print(len(brr))
	print(*brr)
main()


def isCycle(x, k):
	check = True
	for i in range(0, len(x)):
		if x[i] != x[i % k]:
			check = False
			break
	return check
n = int(input())
v = [int(x) for x in input().split()]
x = list()
first = v[0]
x.append(first)
for i in range(1, len(v)):
	xi = v[i] - v[i - 1]
	x.append(xi)
answer = list()
for k in range(1, n + 1):
	if isCycle(x, k):
		answer.append(k)
print(len(answer))
for i in answer:
	print(i, end=' ')


n = int(input())
x = []
a = []
ans = []
a.append(0)
for i in input().split():
	a.append(int(i))
for i in range(n):
	x.append(a[i + 1] - a[i])
for i in range(len(x)):
	m = x[0:i + 1]
	r = len(x)
	flag = True
	for j in range(r):
		if m[j % len(m)] != x[j]:
			flag = False
	if flag:
		ans.append(len(m))
r = len(ans)
print(r)
for i in ans:
	print(i, end=' ')


n = int(input())
a = [int(temp) for temp in input().split()]
a.insert(0, 0)
ccl = []
for k in range(1, n + 1):
	x = [0] * (k + 1)
	f = True
	for i in range(1, len(a)):
		ans = a[i] - a[i - 1]
		if i <= k:
			x[i - 1] = ans
		elif x[(i - 1) % k] != ans:
			f = False
			break
	if f:
		ccl.append(k)
print(len(ccl))
print(*ccl)


n = int(input())
arr = [int(x) for x in input().split()]
arr.insert(0, 0)
k = 1
count = 0
ans = []
while k <= n:
	flag = 0
	x = ['x'] * k
	aa = 1
	while aa <= n:
		if x[(aa - 1) % k] == 'x':
			x[(aa - 1) % k] = arr[aa] - arr[aa - 1]
		elif arr[aa] - arr[aa - 1] != x[(aa - 1) % k]:
			flag = 1
			break
		aa += 1
	if flag == 1:
		k += 1
		continue
	else:
		count += 1
		ans.append(k)
	k += 1
print(count)
for i in range(len(ans)):
	print(ans[i], end=' ')


n = int(input())
xs = [int(x) for x in input().split()]
arr_k = [xs[0]]
for i in range(1, len(xs)):
	arr_k.append(xs[i] - xs[i - 1])
soln = []
for k in range(1, len(arr_k) + 1):
	mul = len(arr_k) // k + 1
	tmp = (arr_k[:k] * mul)[:len(arr_k)]
	if tmp == arr_k:
		soln.append(k)
print(len(soln))
print(' '.join(map(str, soln)))


n = int(input())
a = list(map(int, input().split()))
ks = []
for k in range(1, n + 1):
	x = [None] * k
	curr = 0
	test_fail = False
	for i in range(n):
		xi = a[i] - curr
		if x[i % k] != None and x[i % k] != xi:
			test_fail = True
			break
		elif x[i % k] == None:
			x[i % k] = xi
		else:
			pass
		curr = a[i]
	if test_fail:
		continue
	else:
		ks.append(str(k))
print(len(ks))
print(' '.join(ks))


n = int(input())
A = list(map(int, input().split()))
AX = [0] + A
LIST = []
for i in range(1, n + 1):
	LIST.append(AX[i] - AX[i - 1])
ANSLIST = []
for i in range(1, n + 1):
	check = 1
	for j in range(i, n):
		if LIST[j] != LIST[j % i]:
			check = 0
	if check == 1:
		ANSLIST.append(i)
print(len(ANSLIST))
for a in ANSLIST:
	print(a, end=' ')


n = int(input())
u = list(map(int, input().split()))
for i in range(n - 1, 0, -1):
	u[i] -= u[i - 1]
ans = []
for i in range(1, n):
	d = n // i
	r = n % i
	if u[:i] * d + u[:r] == u:
		ans.append(str(i))
ans.append(str(n))
print(len(ans))
print(' '.join(ans))


n = int(input())
L = [0] + list(map(int, input().split()))
a = []
for i in range(1, n + 1):
	a.append(L[i] - L[i - 1])
res = []
for i in range(1, n):
	if a[:i] == a[n - i:]:
		res.append(n - i)
print(len(res) + 1)
print(*sorted(res), n)


n = int(input())
a = [0] + [int(i) for i in input().split()]
ans = 0
al = []
for k in range(1, n + 1):
	x = []
	for i in range(1, k + 1):
		x.append(a[i] - a[i - 1])
	good = True
	for i in range(k + 1, n + 1):
		if a[i] != x[(i - 1) % k] + a[i - 1]:
			good = False
			break
	if good:
		ans += 1
		al.append(k)
print(ans)
for i in al:
	print(i, end=' ')


from math import *
n = int(input())
a = list(map(int, input().split()))
ans = []
k = 0
for i in range(n):
	ans.append(a[i] - k)
	k = a[i]
s = 0
answer = []
for i in range(1, len(ans) + 1):
	j = ans[:i]
	c = len(j)
	for k in range(len(ans) - c):
		j.append(j[k % c])
	if j == ans:
		s += 1
		answer.append(i)
print(s)
print(*answer)


import math
import bisect
import itertools
import sys

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

def lcm(a, b):
	return a * b // math.gcd(a, b)

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def binsearch(arr, b, low, high):
	if low == high:
		return low
	if arr[math.ceil((low + high) / 2)] < b:
		return binsearch(arr, b, low, math.ceil((low + high) / 2) - 1)
	else:
		return binsearch(arr, b, math.ceil((low + high) / 2), high)
n = int(input())
a = []
x = []
a.append(0)
a += list(map(int, input().split()))
for i in range(1, n + 1):
	x.append(a[i] - a[i - 1])
c = []
for i in range(n):
	b = x[:i + 1]
	if x[:n + 1] == b * (n // (i + 1)) + b[:n % (i + 1)]:
		c.append(i + 1)
print(len(c))
print(*c)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = il()
l2 = []
x = [l[0]]
for i in range(1, n):
	x.append(l[i] - l[i - 1])
for i in range(1, n + 1):
	fg = 0
	for j in range(n):
		if x[j] != x[j % i]:
			fg = 1
	if fg == 0:
		l2.append(i)
print(len(l2))
print(*l2)


n = int(input())
a = [0] + list(map(int, input().split()))
dist = []
for i in range(1, n + 1):
	dist.append(a[i] - a[i - 1])
k_s = []
for k in range(1, n + 1):
	can = True
	for i in range(n):
		if dist[i] == dist[i % k]:
			pass
		else:
			can = False
			break
	if can:
		k_s.append(k)
print(len(k_s))
for t in k_s:
	print(t, end=' ')


def f(x, n, k):
	a = [0]
	for i in range(n):
		a.append(x[i % k] + a[i])
	print(k, a)
n = int(input())
a = list(map(int, input().split()))
b = [a[0]]
for i in range(1, n):
	b.append(a[i] - a[i - 1])
L = []
m = len(b)
for d in range(1, n + 1):
	fl = True
	j = 0
	while j + d < m:
		if b[j] != b[(j + d) % m]:
			fl = False
			break
		j += 1
	if fl:
		L.append(d)
print(len(L))
for i in L:
	print(i, end=' ')
print()


n = int(input())
a = list(map(int, input().split()))
x = [a[0]]
s = ''
c = 0
for i in range(1, n):
	x.append(a[i] - a[i - 1])
for i in range(1, n + 1):
	g = 0
	j = 0
	while j < n:
		if x[j] != x[j % i]:
			g = 1
			break
		j += 1
	if g == 0:
		s = s + str(i) + ' '
		c += 1
print(c)
print(s)


n = int(input())
arr = [0] + [int(i) for i in input().split(' ')]
diff = [arr[i] - arr[i - 1] for i in range(1, len(arr))]
poss = []
for xlen in range(1, len(diff) + 1):
	rep = diff[0:xlen]
	for startpos in range(xlen, len(diff), xlen):
		currarr = diff[startpos:min(startpos + xlen, len(diff))]
		for obj in range(len(currarr)):
			if rep[obj] != currarr[obj]:
				break
		else:
			continue
		break
	else:
		poss.append(xlen)
print(len(poss))
print(' '.join([str(i) for i in poss]))


n = int(input())
a = input().split()
b = [0] * n
b[0] = int(a[0])
for i in range(1, n):
	b[i] = int(a[i]) - int(a[i - 1])
works = 0
out = ''
for j in range(1, n + 1):
	bo = True
	for k in range(n):
		if b[k] != b[k % j]:
			bo = False
			break
	if bo:
		works += 1
		out += str(j) + ' '
print(works)
print(out[:-1])


n = int(input())
s = list(map(int, input().split()))
ans = []
a = [s[0]]
for i in range(1, n):
	a.append(s[i] - s[i - 1])
te = []
for k in range(1, n + 1):
	te = a[:k] * (n // k) + a[:n % k]
	if te == a:
		ans.append(k)
print(len(ans))
print(' '.join(list(map(str, ans))))


n = int(input())
a = []
b = []
a = list(map(int, input().split()))
a.insert(0, 0)
l = n
while l > 0:
	a[l] = a[l] - a[l - 1]
	l = l - 1
for i in range(2, n + 1):
	if a[1] == a[i]:
		l = i - 1
		k = 0
		t = 0
		for j in range(l + 1, n + 1):
			t += 1
			if a[t] == a[j]:
				k += 1
			if t == l:
				t = 0
		if k == n - l:
			b.append(l)
b.append(n)
print(len(b))
print(*b, sep=' ')


n = int(input())
a = [int(i) for i in input().split()]
ans = []
for k in range(1, n + 1):
	x = [a[0]]
	flag = True
	for j in range(1, n):
		if len(x) < k:
			x.append(a[j] - a[j - 1])
		elif x[j % k] != a[j] - a[j - 1]:
			flag = False
			break
	if not flag:
		continue
	ans.append(k)
print(len(ans))
print(*ans)


from sys import stdin, stdout
import cProfile, math
from collections import Counter
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10000000)

class Operation:

	def __init__(self, name, function, function_on_equal, neutral_value=0):
		self.name = name
		self.f = function
		self.f_on_equal = function_on_equal

def add_multiple(x, count):
	return x * count

def min_multiple(x, count):
	return x

def max_multiple(x, count):
	return x
sum_operation = Operation('sum', sum, add_multiple, 0)
min_operation = Operation('min', min, min_multiple, 1000000000.0)
max_operation = Operation('max', max, max_multiple, -1000000000.0)

class SegmentTree:

	def __init__(self, array, operations=[sum_operation, min_operation, max_operation]):
		self.array = array
		if type(operations) != list:
			raise TypeError('operations must be a list')
		self.operations = {}
		for op in operations:
			self.operations[op.name] = op
		self.root = SegmentTreeNode(0, len(array) - 1, self)

	def query(self, start, end, operation_name):
		if self.operations.get(operation_name) == None:
			raise Exception('This operation is not available')
		return self.root._query(start, end, self.operations[operation_name])

	def summary(self):
		return self.root.values

	def update(self, position, value):
		self.root._update(position, value)

	def update_range(self, start, end, value):
		self.root._update_range(start, end, value)

	def __repr__(self):
		return self.root.__repr__()

class SegmentTreeNode:

	def __init__(self, start, end, segment_tree):
		self.range = (start, end)
		self.parent_tree = segment_tree
		self.range_value = None
		self.values = {}
		self.left = None
		self.right = None
		if start == end:
			self._sync()
			return
		self.left = SegmentTreeNode(start, start + (end - start) // 2, segment_tree)
		self.right = SegmentTreeNode(start + (end - start) // 2 + 1, end, segment_tree)
		self._sync()

	def _query(self, start, end, operation):
		if end < self.range[0] or start > self.range[1]:
			return None
		if start <= self.range[0] and self.range[1] <= end:
			return self.values[operation.name]
		self._push()
		left_res = self.left._query(start, end, operation) if self.left else None
		right_res = self.right._query(start, end, operation) if self.right else None
		if left_res is None:
			return right_res
		if right_res is None:
			return left_res
		return operation.f([left_res, right_res])

	def _update(self, position, value):
		if position < self.range[0] or position > self.range[1]:
			return
		if position == self.range[0] and self.range[1] == position:
			self.parent_tree.array[position] = value
			self._sync()
			return
		self._push()
		self.left._update(position, value)
		self.right._update(position, value)
		self._sync()

	def _update_range(self, start, end, value):
		if end < self.range[0] or start > self.range[1]:
			return
		if start <= self.range[0] and self.range[1] <= end:
			self.range_value = value
			self._sync()
			return
		self._push()
		self.left._update_range(start, end, value)
		self.right._update_range(start, end, value)
		self._sync()

	def _sync(self):
		if self.range[0] == self.range[1]:
			for op in self.parent_tree.operations.values():
				current_value = self.parent_tree.array[self.range[0]]
				if self.range_value is not None:
					current_value = self.range_value
				self.values[op.name] = op.f([current_value])
		else:
			for op in self.parent_tree.operations.values():
				result = op.f([self.left.values[op.name], self.right.values[op.name]])
				if self.range_value is not None:
					bound_length = self.range[1] - self.range[0] + 1
					result = op.f_on_equal(self.range_value, bound_length)
				self.values[op.name] = result

	def _push(self):
		if self.range_value is None:
			return
		if self.left:
			self.left.range_value = self.range_value
			self.right.range_value = self.range_value
			self.left._sync()
			self.right._sync()
			self.range_value = None

	def __repr__(self):
		ans = '({}, {}): {}\n'.format(self.range[0], self.range[1], self.values)
		if self.left:
			ans += self.left.__repr__()
		if self.right:
			ans += self.right.__repr__()
		return ans

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def primeFactors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def isprime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def test_print(*args):
	if test:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result
TestCases = False
test = False

def cmp(l1, l2):
	if len(l1) != len(l2):
		print('lenght mismatch', l1, l2)
	for i in range(len(l1)):
		if l1[i] != l2[i]:
			return False
	return True

def main():
	n = get_int()
	li = [0] + get_list()
	diff = list()
	res = list()
	for i in range(1, n + 1):
		diff.append(li[i] - li[i - 1])
	li = diff
	for i in range(1, n):
		we = li[:i]
		works = True
		for j in range(0, n, i):
			if j + i > n:
				if we[0:n - j] != li[j:]:
					works = False
					break
			elif we != li[j:j + i]:
				works = False
				break
		if works:
			res.append(i)
	res.append(n)
	print(len(res))
	display_list(res)
if TestCases:
	for _ in range(get_int()):
		cProfile.run('main()') if test else main()
else:
	cProfile.run('main()') if test else main()


def tr(s, k):
	a = 0
	s1 = []
	for i in range(1, len(s)):
		s1.append(s[i] - s[i - 1])
	t = True
	for j in range(1, len(s)):
		if s[j] != s[j - 1] + s1[(j - 1) % k]:
			t = False
			break
	return t
from sys import stdin
n = int(stdin.readline().strip())
s = [0] + list(map(int, stdin.readline().strip().split()))
ans = []
for i in range(1, n + 1):
	if tr(s, i):
		ans.append(i)
print(len(ans))
print(*ans)


def K(a, b):
	bl = True
	for i in range(0, len(a)):
		if a[i] != a[i % b]:
			bl = False
			break
	return bl
n = int(input())
arr = [int(x) for x in input().split()]
x = list()
fi = arr[0]
x.append(fi)
for i in range(1, len(arr)):
	xi = arr[i] - arr[i - 1]
	x.append(xi)
result = list()
for item in range(1, n + 1):
	if K(x, item):
		result.append(item)
print(len(result))
for i in result:
	print(i, end=' ')


n = int(input())
arr = list(map(int, input().split()))
(possibilities, ans) = (list(), list())
old = 0
for (idx, v) in enumerate(arr):
	possibilities.append(v - old)
	old = v
limit = 1
while limit <= len(possibilities):
	matched = True
	for i in range(limit):
		idx = i
		v = possibilities[idx]
		while idx < len(possibilities):
			if possibilities[idx] != v:
				matched = False
				break
			idx += limit
		if not matched:
			break
	if matched:
		ans.append(limit)
	limit += 1
print(len(ans))
print(*ans)


I = lambda : map(int, input().split())
n = int(input())
a = list(I())
b = [a[0]]
for i in range(1, n):
	b.append(a[i] - a[i - 1])
c = []
for i in range(1, n + 1):
	x = b[:i] * (n // i) + b[:n % i]
	if x == b:
		c.append(i)
print(len(c))
print(*c)


def main():
	n = int(input())
	a = [0] + list(map(lambda x: int(x), input().split(' ')))
	d = [a[i + 1] - a[i] for i in range(len(a) - 1)]
	ans = 1
	alist = []
	for i in range(1, n):
		flag = True
		for j in range(n):
			if j >= i and d[j] != d[j - i]:
				flag = False
				break
		if flag:
			alist.append(i)
			ans += 1
	alist.append(n)
	print(ans)
	print(' '.join([str(x) for x in alist]))
main()


def g_couple(itr):
	a = next(itr)
	for b in itr:
		yield (a, b)
		a = b

def g_input(str):
	nb = 0
	for c in str:
		if c != ' ':
			nb = nb * 10 + int(c)
		else:
			yield nb
			nb = 0
	yield nb

def main():
	n = int(input())
	a = list(g_input(input()))
	nb_x_possible = 1
	len_x_possible = [n]
	prec = 0
	x = []
	for (i, ai) in enumerate(a):
		if x != [] and x[0] == ai - prec:
			prec_j = ai
			test = True
			for (j, aij) in enumerate(a[i + 1:]):
				if x[(j + 1) % len(x)] != aij - prec_j:
					test = False
				prec_j = aij
			if test:
				nb_x_possible += 1
				len_x_possible += [len(x)]
		x += [ai - prec]
		prec = ai
	len_x_possible.sort()
	print(nb_x_possible)
	len_x_possible = [str(i) for i in len_x_possible]
	print(' '.join(len_x_possible))
main()


n = int(input())
a = [0] + [int(i) for i in input().split(' ')]
diffs = [n - p for (p, n) in zip(a[:-1], a[1:])]
subsequence = [diffs[0]]
diff_pointer = 1
from math import ceil

def is_tiled(a, b):
	for (a_one, b_one) in zip(a * ceil(len(b) / len(a)), b):
		if a_one != b_one:
			return False
	return True
while diff_pointer < n:
	if is_tiled(subsequence, diffs[diff_pointer:]):
		break
	subsequence.append(diffs[diff_pointer])
	diff_pointer += 1
answer = []
poly = ceil(n / diff_pointer) - 1
for i in range(poly):
	answer.append(diff_pointer * (i + 1))
for i in range(poly * diff_pointer + 1, n + 1):
	if is_tiled(diffs[:i], diffs[i:]):
		answer.append(i)
print(len(answer))
print(' '.join([str(i) for i in answer]))


from sys import stdin, stdout
from math import *

def test(k):
	global n, a
	x = []
	for i in range(k):
		x.append(a[i + 1] - a[i])
	for i in range(1, n + 1):
		if a[i] != x[(i - 1) % k] + a[i - 1]:
			return False
	return True

def main():
	global n, a, res
	n = int(stdin.readline())
	a = [0] + [int(x) for x in stdin.readline().split()]
	res = []
	for k in range(1, n + 1):
		if test(k):
			res.append(str(k))
	stdout.write(str(len(res)) + '\n' + ' '.join(res))
	return 0
main()


(n, a) = (int(input()), list(map(int, input().split())))
(arr, s, ans) = ([a[0]], a[0], [])
for i in range(n):
	for j in range(i + 1, n):
		s += arr[j % (i + 1)]
		if s != a[j]:
			s = 0
			break
	if s != 0:
		ans.append(i + 1)
	if i + 1 < n:
		arr.append(a[i + 1] - a[i])
		s = sum(arr)
print(len(ans))
print(*ans)


from sys import stdin, stdout, exit
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
a.insert(0, 0)
(k, step) = (0, set())
for i in range(n):
	a[i] = a[i + 1] - a[i]
for i in range(n):
	(k, tmp, flg) = (k + 1, 0, 1)
	for j in range(i + 1, n):
		if a[j] != a[tmp]:
			flg = 0
			break
		tmp += 1
		if tmp == k:
			tmp = 0
	if flg:
		for i in range(n):
			if not (i + 1) % k:
				step.add(i + 1)
stdout.write('%d\n' % len(step))
step = sorted(step)
for i in range(len(step)):
	stdout.write('%d ' % step[i])


def check(d, length):
	n = len(d)
	t = d[:length]
	for (i, item) in enumerate(d):
		if t[i % length] != item:
			return False
	return True

def calc(a):
	k = []
	d = []
	last = 0
	for item in a:
		d.append(item - last)
		last = item
	for i in range(len(a)):
		if check(d, i + 1):
			k.append(i + 1)
	return k

def get_ints():
	return [int(n) for n in input().split()]

def get_floats():
	return [float(n) for n in input().split()]

def seq2str(seq):
	return ' '.join((str(item) for item in seq))

def __starting_point():
	a = get_ints()
	assert len(a) == 1
	n = a[0]
	a = get_ints()
	assert len(a) == n
	k = calc(a)
	print(len(k))
	print(seq2str(k))
__starting_point()


def check(k, a):
	for i in range(0, len(a) - k - 1):
		if a[i + 1] - a[i] != a[i + k + 1] - a[i + k]:
			return False
	return True

def f(a):
	ans = []
	a = [0] + a
	for i in range(1, len(a)):
		if check(i, a):
			ans.append(i)
	print(len(ans))
	return ans
a = input()
lst = list(map(int, input().strip().split()))
print(*f(lst))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
N = int(input())
A = [0] + [int(x) for x in input().split()]

def check(k):
	X = [0] * k
	vis = [False] * k
	for i in range(1, N + 1):
		ai = A[i]
		x = ai - A[i - 1]
		ix = (i - 1) % k
		if not vis[ix]:
			vis[ix] = True
			X[ix] = x
		elif X[ix] != x:
			return False
	return True
ans = []
for i in range(1, N + 1):
	if check(i):
		ans.append(i)
print(len(ans))
print(' '.join(map(str, ans)))


n = int(input())
a = list(map(lambda x: int(x), input().split(' ')))
b = list(map(lambda x: x[1] - x[0], zip([0, *a], [*a, 0])))[:-1]
counts = 0
results = []
for i in range(1, n + 1):
	array = [None] * i
	k = 0
	while k < n:
		if array[k % i] == None:
			array[k % i] = b[k]
		elif array[k % i] != b[k]:
			break
		k = k + 1
	if k == n:
		counts = counts + 1
		results.append(i)
print(counts)
print(' '.join(map(lambda x: str(x), results)))


n = int(input())
b = list()
a = [0] + [int(i) for i in input().split()]
for k in range(1, n + 1):
	c = list()
	for i in range(k):
		c.append(a[i + 1] - a[i])
	for i in range(k, n):
		if a[i + 1] - a[i] != c[i % k]:
			break
	else:
		b.append(k)
b.sort()
print(len(b))
print(' '.join(map(str, b)))


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
a = [0] + li()
d = [a[i] - a[i - 1] for i in range(1, n + 1)]
ans = []
for i in range(1, n + 1):
	ok = all((d[j] == d[j % i] for j in range(n)))
	if ok:
		ans.append(i)
print(len(ans))
print(*ans)


def B(number, a):
	for i in range(len(a))[:0:-1]:
		a[i] = a[i] - a[i - 1]
	appropriate_length = []
	for length in range(1, len(a)):
		if check(a, length):
			appropriate_length.append(length)
	return appropriate_length + [len(a)]

def check(a, length):
	iterations = len(a) // length
	if range(len(a) % length):
		iterations += 1
	for x in range(length):
		for index in range(1, iterations):
			if length * index + x < len(a):
				if a[length * index + x] != a[length * (index - 1) + x]:
					return False
	return True
number = int(input())
a = [int(x) for x in input().split()]
x = B(number, a)
print(len(x))
print(*x)


n = int(input())
array = list(map(int, input().split()))
ar = [array[0]]
for i in range(1, n):
	ar.append(array[i] - array[i - 1])
out = []
for size in range(1, n + 1):
	repeat = n // size
	check = ar[:size]
	if repeat != n / size:
		repeat += 1
	nextsize = 0
	for i in range(repeat):
		checkwith = ar[i * size:(i + 1) * size]
		check = check[:len(checkwith)]
		if check != checkwith:
			nextsize = 1
			break
	if nextsize == 0:
		out.append(str(size))
print(len(out))
print(' '.join(out))


n = int(input())
a = list(map(int, input().strip().split()))
a.insert(0, 0)
X = []
ans = []
for i in range(1, n + 1):
	X.append(a[i] - a[i - 1])
for i in range(1, n):
	if X[i:len(X)] == X[0:len(X) - i]:
		ans.append(i)
ans.append(n)
ans.sort()
print(len(ans))
for i in range(0, len(ans) - 1):
	print(ans[i], end=' ')
print(ans[len(ans) - 1])


n = int(input())
arr = list(map(int, input().split()))
a = list()
a.append(0)
for i in range(n):
	a.append(arr[i])

def ok(d):
	for i in range(n):
		if i + d >= n:
			break
		if a[i + 1] - a[i] != a[i + d + 1] - a[i + d]:
			return False
	return True
b = list()
for i in range(1, n + 1):
	if ok(i):
		b.append(i)
print(len(b))
print(*b)


n = int(input())
a = list(map(int, input().split()))
for i in range(n - 1, 0, -1):
	a[i] -= a[i - 1]
lens = []
for l in range(1, n + 1):
	f = True
	for i in range(n):
		if a[i] != a[i % l]:
			f = False
	if f:
		lens.append(l)
print(len(lens))
for i in lens:
	print(i, end=' ')


n = int(input())
a = [int(s) for s in input().split()]
b = [0] * (n + 1)
b[1] = a[0]
for i in range(2, n + 1):
	b[i] = a[i - 1] - a[i - 2]
result = []

def check(k):
	for i in range(1, k + 1):
		j = 0
		flag = True
		while j * k + i <= n:
			if (b[j * k + i] - b[i]) % k != 0 or b[j * k + i] - b[i] >= k or b[j * k + i] - b[i] < 0:
				return False
			j += 1
	return True
for k in range(1, n + 1):
	if check(k):
		result.append(k)
print(len(result))
for s in result:
	print(s, end=' ')


n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
l = []
for i in range(n):
	l.append(a[i + 1] - a[i])
r = []
for i in range(1, n + 1):
	m = l[:i]
	j = 0
	k = i
	f = True
	while k < n:
		if m[j] == l[k]:
			j = (j + 1) % i
			k += 1
		else:
			f = False
			break
	if f == True:
		r.append(i)
print(len(r))
print(' '.join(map(str, r)))


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
except Exception:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(N,) = getIntList()
za = [0] + getIntList()
zb = []
for i in range(N):
	zb.append(za[i + 1] - za[i])
dprint(zb)
res = [N]
for i in range(1, N):
	ok = True
	for j in range(i, N):
		if zb[j] != zb[j % i]:
			ok = False
			break
	if ok:
		res.append(i)
res.sort()
print(len(res))
for x in res:
	print(x, end=' ')


n = int(input())
a = list(map(int, input().split()))
an = [a[0]]
for i in range(1, n):
	an.append(a[i] - a[i - 1])
ans = []
for i in range(1, n + 1):
	c = an[:i] * (n // i) + an[:n % i]
	if c == an:
		ans.append(i)
print(len(ans))
print(*ans)


from fractions import Fraction
import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(inp())
	b = lis()
	a = [b[0]]
	for i in range(1, n):
		a.append(b[i] - b[i - 1])
	temp = []
	for i in range(1, n + 1):
		f = True
		for j in range(0, n):
			if a[j] != a[j % i]:
				f = False
				break
		if f:
			temp.append(i)
	temp = sorted(temp)
	print(len(temp))
	print(*temp)
testcase(1)


import sys
n = int(input())
a = [0] + [int(i) for i in input().split()]
a = [a[i + 1] - a[i] for i in range(len(a) - 1)]
ans = ''
cnt = 0
k = 1
while k <= n:
	good = True
	for j in range(k):
		if len(set(a[j::k])) > 1:
			good = False
			break
	if good:
		ans += ' ' + str(k)
		cnt += 1
	k += 1
print(cnt)
print(ans[1:])


n = input()
k = [int(v) for v in input().split(' ')]
v = [k[i] - (k[i - 1] if i > 0 else 0) for i in range(len(k))]
av = v
ans = []
for i in range(1, len(v)):
	f = True
	for j in range(len(v)):
		f &= v[j % i] == v[j]
	if f:
		ans.append(i)
ans.append(len(v))
print(len(ans))
print(' '.join([str(v) for v in ans]))


import sys
import math

def period(x):
	n = len(x)
	res = []
	for i in range(1, len(x)):
		if all((i == j for (i, j) in zip(x, x[i:]))):
			res.append(i)
	return res + [n]

def main():
	[n] = map(int, next(sys.stdin).split())
	a = list(map(int, next(sys.stdin).split()))
	a = [0] + a
	x = [j - i for (i, j) in zip(a, a[1:])]
	periods = period(x)
	print(len(periods))
	print(' '.join(map(str, periods)))

def __starting_point():
	main()
__starting_point()


import math
n = int(input())
l = list(map(int, input().split()))
a = 0
m = []
c = 0
s = []
for i in l:
	m += [i - a]
	a = i
j = 0
while j < n:
	if m[0:j + 1] == m[n - 1 - j:]:
		s += [n - 1 - j]
		c += 1
	j += 1
print(c)
s = s[:-1]
s.sort()
s = s + [n]
for i in s:
	print(i, end=' ')


n = int(input())
a = list(map(int, input().split()))
a = [0] + a
x = [0] * n
n = n + 1
ans = []
for k in range(1, n):
	flag = 0
	for i in range(1, n):
		if i <= k:
			x[(i - 1) % k] = a[i] - a[i - 1]
		elif x[(i - 1) % k] == a[i] - a[i - 1]:
			continue
		else:
			flag = 1
			break
	if flag == 0:
		ans.append(k)
print(len(ans))
for i in range(len(ans)):
	print(ans[i], end=' ')


n = int(input())
num = list(map(int, input().split()))
num.insert(0, 0)
cha = []
for i in range(1, n + 1):
	cha.append(num[i] - num[i - 1])
output = set()
for e in range(1, 1 + n):
	ge = n // e
	if cha[:e] * ge == cha[:e * ge] and (cha[ge * e:] == cha[:n - ge * e] or cha[ge * e:] == []):
		zq = e
		output.add(zq)
output.add(n)
output = list(output)
output.sort()
print(len(output))
print(' '.join((str(o) for o in output)))


n = int(input())
a = list(map(int, input().split()))
b = []
c = [a[0]]
for i in range(1, n):
	c.append(a[i] - a[i - 1])
p = 1
for i in range(1, n):
	q = c[:n - i]
	w = c[i:]
	if q == w:
		b.append(i)
		p += 1
b.append(n)
print(p)
print(*b)


n = int(input())
a = [0] + list(map(int, input().split()))
res = []
for i in range(1, n + 1):
	x = [0] * i
	possible = True
	for j in range(i):
		x[j] = a[j + 1] - a[j]
	for j in range(i, n):
		if x[j % i] != a[j + 1] - a[j]:
			possible = False
			break
	if possible:
		res.append(i)
print(len(res))
print(' '.join(map(str, res)))


n = int(input()) + 1
a = [0] + list(map(int, input().split()))
x = [a[(i + 1) % n] - a[i] for i in range(0, n - 1)]
answ = []
for k in range(1, n):
	xs = x[:k]
	xss = (xs * ((n + k - 1) // k))[:n - 1]
	if xss == x:
		answ.append(k)
print(len(answ))
for i in answ:
	print(i, end=' ')


n = int(input())
a = [0]
a += list(map(int, input().split()))
count = 0
ans = []
z = []
for i in range(1, n + 1):
	z.append(a[i] - a[i - 1])
for i in range(1, n + 1):
	p = z[:i] * (n // i + 1)
	if p[:n] == z:
		count += 1
		ans.append(i)
print(count)
print(' '.join(map(str, ans)))


n = int(input())
b = list(map(int, input().split()))
a = [0] * (n + 1)
k = 0
for i in range(1, n + 1):
	a[i] = b[i - 1]
b = [0] * n
r = ['']
for i in range(n):
	b[i] = a[i + 1] - a[i]
for i in range(1, n):
	if b[i] == b[0]:
		d = i
		for j in range(n - i):
			if b[j] != b[j + i]:
				q = 1
				break
			else:
				q = 0
		if q == 0:
			k = k + 1
			r.append(i)
r.pop(0)
print(k + 1)
print(*r, n)


from __future__ import print_function

def is_cycle(seq, k):
	ii = 0
	for i in range(len(seq)):
		if ii == k:
			ii = 0
		if seq[i] != seq[ii]:
			return False
		ii += 1
	return True
n = int(input())
A = [0] + [int(x) for x in input().split()]
AA = []
for i in range(1, len(A)):
	AA.append(A[i] - A[i - 1])
cyqs = []
for cyq in range(1, len(A)):
	if is_cycle(AA, cyq):
		cyqs.append(cyq)
print(len(cyqs))
print(*cyqs)


n = int(input())
arr = list(map(int, input().split()))
ile = 0
wynik = [i for i in range(n + 1)]
for k in range(1, n + 1):
	x = [None for _ in range(n)]
	x[0] = arr[0]
	tmp = True
	for i in range(1, n):
		if x[i % k] == None:
			x[i] = arr[i] - arr[i - 1]
		elif arr[i] - arr[i - 1] != x[i % k]:
			ile += 1
			wynik[k] = 0
			tmp = False
			break
print(n - ile)
for i in wynik:
	if i:
		print(i, end=' ')


def isvalid(k):
	for i in range(n - k):
		if lfi[i] != lfi[i + k]:
			return 0
	return 1
n = int(input())
l = input().split()
li = [int(i) for i in l]
lfi = []
lfi.append(li[0])
for i in range(1, n):
	lfi.append(li[i] - li[i - 1])
lans = []
for i in range(1, n + 1):
	if isvalid(i):
		lans.append(i)
print(len(lans))
for i in lans:
	print(i, end=' ')
print()


n = int(input())
a = list(map(int, input().split()))
b = [a[0]]
for i in range(1, n):
	b.append(a[i] - a[i - 1])
cnt = 0
d = []
for i in range(n):
	check = False
	for j in range(n):
		if b[j] != b[j % (i + 1)]:
			check = True
	if not check:
		d.append(i + 1)
print(len(d))
for i in d:
	print(i, end=' ')


n = int(input())
a = list(map(int, input().split()))
b = [0] * 1005
ans = [0] * 1005
b[0] = a[0]
for i in range(1, n):
	b[i] = a[i] - a[i - 1]
cnt = 0
for i in range(1, n):
	if b[i] == b[0]:
		ok = 1
		for j in range(0, i):
			if ok == 0:
				break
			for k in range(1, n // i + 1):
				if j + k * i >= n:
					break
				if b[j] != b[j + k * i]:
					ok = 0
					break
		if ok:
			ans[cnt] = i
			cnt += 1
ans[cnt] = n
cnt += 1
print(cnt)
for i in range(cnt):
	print(ans[i], end=' ')
print()


from math import inf as inf
from math import *
from collections import *
import sys
input = sys.stdin.readline
t = 1
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	di = [a[0]]
	for i in range(1, n):
		di.append(a[i] - a[i - 1])
	r = []
	for i in range(n):
		flag = 0
		for j in range(i + 1, n):
			if di[j] != di[j % (i + 1)]:
				flag = 1
				break
		if not flag:
			r.append(i + 1)
	print(len(r))
	print(*r)


from itertools import cycle
n = int(input())
A = [0] + [int(num) for num in input().split(' ')]
X = [A[i] - A[i - 1] for i in range(1, len(A))]
result = []
for i in range(1, len(X) + 1):
	left = cycle(X[:i])
	right = iter(X[i:])
	while True:
		try:
			if next(left) != next(right):
				break
		except StopIteration:
			result.append(i)
			break
print(len(result))
print(' '.join([str(j) for j in result]))


def lost_array(n, a):
	possible = []
	diff = [a[0]]
	for i in range(1, n):
		diff.append(a[i] - a[i - 1])
	output = []
	for k in range(1, n + 1):
		for s in range(k):
			e = diff[s]
			i = s
			while i < n:
				if diff[i] != e:
					break
				i += k
			else:
				continue
			break
		else:
			output.append(k)
	return output
n = int(input())
a = list(map(int, input().split()))
output = lost_array(n, a)
print(len(output))
print(' '.join(map(str, output)))


n = int(input())
a = list(map(int, input().split()))
ans = []
for k in range(1, n + 1):
	x = [0] * k
	x[0] = a[0]
	for i in range(1, k):
		x[i] = a[i] - a[i - 1]
	ok = True
	for i in range(k, n):
		if x[i % k] != a[i] - a[i - 1]:
			ok = False
			break
	if ok:
		ans.append(k)
print(len(ans))
print(*ans)


n = int(input())
A = input().split()
A = [0] + [int(ai) for ai in A]
valid_k = []
for k in range(1, n + 1):
	X = []
	isvalid = True
	for i in range(1, n + 1):
		if i <= k:
			X.append(A[i] - A[i - 1])
		elif X[(i - 1) % k] != A[i] - A[i - 1]:
			isvalid = False
			break
	if isvalid:
		valid_k.append(k)
print(len(valid_k))
print(' '.join([str(k) for k in valid_k]))


def scand():
	return int(input())

def scana():
	return [int(x) for x in input().split()]
n = scand()
a = [0] + scana()
x = [str(a[i] - a[i - 1]) for i in range(1, len(a))]
ans = []
for i in range(1, n + 1):
	ok = True
	for j in range(0, n):
		if x[j] != x[j % i]:
			ok = False
			break
	if ok:
		ans.append(str(i))
print(len(ans))
print(' '.join(ans))


from collections import defaultdict
import math
n = int(input())
a = [int(x) for x in input().split()]
a = [0] + a
temp = [0 for i in range(n + 1)]
for i in range(n, 0, -1):
	temp[i] = a[i] - a[i - 1]
temp = temp[1:]
result = [n]
for i in range(1, n):
	must = temp[:i]
	ok = True
	for j in range(0, n, i):
		if j + i < n:
			if temp[j:j + i] != must:
				ok = False
				break
		else:
			delta = n - j - 1
			if must[:delta + 1] != temp[j:n]:
				ok = False
				break
	if ok:
		result.append(i)
result.sort()
print(len(result))
print(' '.join([str(i) for i in result]))


n = int(input())
arr = [int(e) for e in input().split()]
arr = [0] + arr
x = []
n += 1
for i in range(n - 1):
	x.append(arr[i + 1] - arr[i])
res = []
for i in range(len(x)):
	x1 = x[0:i + 1]
	check = True
	for j in range(len(x)):
		if x[j] != x1[j % len(x1)]:
			check = False
			break
	if check:
		res.append(len(x1))
print(len(res))
for element in res:
	print(element, end=' ')


n = int(input())
a = [int(k) for k in input().split()]
answ = []
for k in range(1, n + 1):
	prev = 0
	arr = [0 for i in range(k)]
	good = True
	for i in range(n):
		if i < k:
			arr[i] = a[i] - prev
		elif arr[i % k] != a[i] - prev:
			good = False
			break
		prev = a[i]
	if good:
		answ.append(k)
print(len(answ))
print(*answ)


n = int(input())
l = list(map(int, input().split()))
j = []
for i in range(n):
	if i != 0:
		j.append(l[i] - l[i - 1])
	else:
		j.append(l[i])
m = max(j)
k = [i for i in range(1, n + 1)]
c = []
ci = 0
for p in k:
	li = []
	flag = 0
	for i in range(n):
		if i < p:
			li.append(j[i])
		elif li[i % p] != j[i]:
			flag = 1
			break
	if flag == 0:
		c.append(p)
		ci += 1
print(ci)
print(*c)


n = int(input())
arr = list(map(int, input().split()))
ls = [0] * n
ls[0] = arr[0]
f = 0
ans = []
for i in range(1, n):
	ls[i] = arr[i] - arr[i - 1]
for k in range(1, n + 1):
	f = True
	for j in range(n - k):
		if ls[j] != ls[j + k]:
			f = False
			break
	if f == True:
		ans.append(k)
print(len(ans))
print(*ans)


n = int(input())
s = input().split()
a = []
l = 0
last = 0
for i in s:
	a.append(int(i) - last)
	last = int(i)
ans = ''
for i in range(n):
	array = a[:i + 1]
	arr = []
	while len(arr) < n:
		for j in array:
			if len(arr) < n:
				arr.append(j)
	if arr == a:
		l += 1
		ans += str(i + 1) + ' '
print(l)
print(ans)


rd = lambda : list(map(int, input().split()))
(n, a) = (rd()[0], rd())
b = [y - x for (x, y) in zip([0] + a, a)]
ans = []
for k in range(1, n + 1):
	(i, j) = (0, k)
	while j < n and b[i] == b[j]:
		i += 1
		j += 1
	if j == n:
		ans.append(k)
print(len(ans), *ans)


import sys
input = sys.stdin.readline
mii = lambda : map(int, input().split())
n = int(input())
a = [0] + list(mii())
diff = [a[i + 1] - a[i] for i in range(n)]
ans = []
for i in range(1, n + 1):
	good = 1
	for j in range(n - i):
		if diff[j] != diff[j + i]:
			good = 0
	if good:
		ans.append(i)
print(len(ans))
print(' '.join(map(str, ans)))


n = int(input())
lens = []
arr = [0] + [int(x) for x in input().split()]
arr = tuple(arr)
for k in range(1, n + 1):
	xses = []
	for i in range(1, k + 1):
		xses.append(arr[i] - arr[i - 1])
	a = [0]
	for i in range(n):
		a.append(a[-1] + xses[i % k])
	a = tuple(a)
	if a == arr:
		lens.append(k)
print(len(lens))
print(*lens)


n = int(input()) + 1
a = [int(x) for x in input().split()]
a = [0] + a
l = []
x = []
for tl in range(1, n):
	x.append(a[tl] - a[tl - 1])
	tlt = False
	for os in range(0, n // tl + (1 if n % tl != 0 else 0)):
		if tlt:
			break
		for i in range(0, tl):
			if os * tl + i + 1 >= n:
				l.append(tl)
				tlt = True
				break
			if a[os * tl + i + 1] - a[os * tl + i] != x[i]:
				tlt = True
				break
print(len(l))
print(*l)


n = int(input())
a = [0] + [int(i) for i in input().split()]
d = [a[i] - a[i - 1] for i in range(1, n + 1)]
ans = []
for i in range(1, n + 1):
	if (d[:i] * (n // i + 20))[:n] == d:
		ans.append(i)
print(len(ans))
print(' '.join([str(i) for i in ans]))


n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
res = []
for k in range(1, n + 1):
	x = [0] * (k + 1)
	f = True
	for i in range(1, len(a)):
		ans = a[i] - a[i - 1]
		if i <= k:
			x[i - 1] = ans
		elif x[(i - 1) % k] != ans:
			f = False
			break
	if f:
		res.append(k)
print(len(res))
print(*res)


n = int(input())
a = list(map(int, input().split()))
tmp = [a[0]] * n
for i in range(1, n):
	tmp[i] = a[i] - a[i - 1]
ans = [i for i in range(1, n + 1) if tmp[i:] == tmp[:-i]]
print(len(ans))
print(*ans)


def program():
	_ = input()
	a = [0] + [int(x) for x in input().split()]
	diffs = []
	for i in range(len(a) - 1):
		diffs.append(a[i + 1] - a[i])
	goods = []
	for xLen in range(1, len(diffs)):
		good = True
		for i in range(len(diffs)):
			if diffs[i] != diffs[i % xLen]:
				good = False
				break
		if good:
			goods.append(xLen)
	goods.append(len(diffs))
	print(len(goods))
	print(' '.join(map(str, goods)))
program()


n = int(input())
arr = tuple(map(int, input().split()))
n = len(arr)
answers = [0] * n
answer_len = 0
arr = (arr[0],) + tuple((arr[i + 1] - arr[i] for i in range(n - 1)))
for length in range(1, n + 1):
	for i in range(n - length):
		if arr[i + length] != arr[i]:
			break
	else:
		answers[answer_len] = length
		answer_len += 1
print(answer_len)
print(*answers[:answer_len])


n = int(input())
a = [0] + list(map(int, input().split()))
a_dif = [a[i] - a[i - 1] for i in range(1, n + 1)]
answers = []
k = 1
b = True
while k <= n:
	for i in range(k):
		el = a_dif[i]
		for e in range((n - i) // k + int(bool((n - i) % k))):
			if a_dif[i + e * k] != el:
				b = False
				break
		if not b:
			break
	if b:
		answers.append(k)
	k += 1
	b = True
print(len(answers))
print(*answers)


a = int(input())
mass = input().split()
mass_a = [0] * (a + 1)
for i in range(a):
	mass_a[i + 1] = int(mass[i])
mass_x = [0] * a
for i in range(1, a + 1):
	mass_x[i - 1] = mass_a[i] - mass_a[i - 1]
n = 0
mass = []
for i in range(1, a + 1):
	flag = True
	for j in range(a):
		if mass_x[j] != mass_x[j % i]:
			flag = False
	if flag:
		n += 1
		mass.append(i)
print(n)
print(*mass)


n = int(input())
a = list(map(int, input().split()))
a = [0] + a
ans = list()
for k in range(1, n + 1):
	x = list()
	for ind in range(1, k + 1):
		x.append(a[ind] - a[ind - 1])
	possible_k = True
	for ind in range(k + 1, n + 1):
		if a[ind] - a[ind - 1] != x[(ind - 1) % k]:
			possible_k = False
			break
	if possible_k:
		ans.append(k)
print(len(ans))
for elem in ans:
	print(elem, end=' ')


def main():
	n = int(input())
	a = [0] + [int(x) for x in input().strip().split()]
	ans = []
	for k in range(1, n + 1):
		offset = a[k]
		possible = True
		for i in range(k + 1, n + 1, k):
			for j in range(k):
				if i + j < n + 1 and a[i + j] - a[i + j - k] != offset:
					possible = False
			if not possible:
				break
		if possible:
			ans.append(k)
	print(len(ans))
	for x in ans:
		print(x, end=' ')
	print()
main()


n = int(input())
a = list(map(int, input().split()))
b = [0] * n
ans = []
b[0] = a[0]
for i in range(1, n):
	b[i] = a[i] - a[i - 1]
for i in range(1, n + 1):
	loc = b[:i]
	for j in range(i, n - n % i, i):
		if b[j:j + i] != loc:
			break
	else:
		loc2 = b[n - n % i:]
		if loc2 == loc[:len(loc2)]:
			ans.append(i)
print(len(ans))
print(*ans)


from itertools import tee, chain

def pairwise(it):
	(a, b) = tee(it)
	next(b, None)
	return zip(a, b)
n = int(input())
a = map(int, input().split())
b = list(map(lambda pair: pair[1] - pair[0], pairwise(chain([0], a))))
ans = []
for q in range(1, n + 1, 1):
	can = True
	if not any((q % w == 0 for w in ans)):
		can = all((b[e] == b[e % q] for e in range(n)))
	if can:
		ans.append(q)
print(len(ans))
print(' '.join(map(str, ans)))


n = int(input())
carr = list(map(int, input().split()))
res = []
arr = [carr[0]] * n
for i in range(1, n):
	arr[i] = carr[i] - carr[i - 1]
for i in range(1, n):
	a = arr[:i]
	was = False
	for j in range(i, n, i):
		tr = arr[j:min(j + i, n + 1)]
		tr2 = a[:len(tr)]
		if not tr2 == tr:
			was = True
			break
	if not was:
		res.append(i)
res.append(n)
print(len(res))
for p in res:
	print(p, end=' ')


import sys
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def read():
	tc = 1
	if tc:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')

def powermod(a, b, m):
	a %= m
	res = 1
	if a == 0:
		return 0
	while b > 0:
		if b & 1:
			res = res * a % m
		b = b >> 1
		a = a * a % m
	return res

def isprime(n):
	if n <= 1:
		return 0
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return 0
	return 1

def solve():
	n = ii()
	a = li()
	x = [a[0]]
	for i in range(1, n):
		x.append(a[i] - a[i - 1])
	f = n
	ans = []
	for i in range(1, n):
		if x[i] == x[0]:
			f = i
			f2 = 1
			for i in range(n):
				if x[i] != x[i % f]:
					f2 = 0
					break
			if f2:
				x1 = f
				while n >= x1:
					ans.append(x1)
					x1 += f
	ans = list(set(ans))
	if n not in ans:
		ans.append(n)
	ans.sort()
	print(len(ans))
	print(*ans)
read()
solve()


temp = input()
temp = input()
a = [0] + temp.split()
n = len(a)
x = []
for i in range(1, n):
	x = x + [int(a[i]) - int(a[i - 1])]
output = [len(x)]
for i in range(1, n - 1):
	combine = []
	temp = x[:i]
	while len(combine) < n - 1:
		combine += temp
	combine = combine[:n - 1]
	if combine == x:
		output = output + [len(temp)]
output.sort()
print(len(output))
for i in output:
	print(i, end=' ')


n = int(input())
a = list(map(int, input().split()))
x = [a[0]]
for i in range(1, n):
	x.append(a[i] - a[i - 1])
x.append(x[0])
sums = [x[0]]
for i in range(1, n):
	sums.append(sums[i - 1] + x[i])
ans = [True for i in range(n)]
for i in range(n):
	for pos in range(1, n - i):
		if a[pos + i] != a[i] + sums[pos - 1]:
			ans[pos - 1] = False
print(ans.count(True))
for i in range(n):
	if ans[i]:
		print(i + 1, end=' ')


n = int(input())
a = [int(x) for x in input().split(' ')]
r = []
for k in range(1, n + 1):
	xs = [a[0]]
	for i in range(1, k):
		xs.append(a[i] - a[i - 1])
	valid = True
	for i in range(k, n):
		if a[i] - a[i - 1] != xs[i % k]:
			valid = False
	if valid:
		r.append(k)
print(len(r))
print(' '.join([str(x) for x in r]))


n = int(input())
arr = list(map(int, input().split()))
val = [arr[0]]
for i in range(1, n):
	val.append(arr[i] - arr[i - 1])
ks = []
for k in range(1, n + 1):
	num = 0
	for i in range(len(val)):
		if val[i] != val[i % k]:
			break
		num += 1
	if num == len(val):
		ks.append(k)
print(str(len(ks)) + '\n')
toPrint = ''
for i in range(len(ks)):
	toPrint += str(ks[i]) + ' '
print(toPrint + '\n')


n = int(input())
a = list(map(int, input().split()))
i = n - 1
while i:
	a[i] -= a[i - 1]
	i -= 1
s = []
for i in range(1, n + 1):
	if a[i:] == a[:-i]:
		s.append(i)
print(len(s))
for i in s:
	print(i, end=' ')


def possible(k, arr):
	n = len(arr)
	x_arr = [float('inf')] * k
	for i in range(1, n):
		xi = arr[i] - arr[i - 1]
		pos = (i - 1) % k
		if x_arr[pos] == float('inf'):
			x_arr[pos] = xi
		elif x_arr[pos] != xi:
			return False
	return True

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.insert(0, 0)
	ans = []
	for i in range(1, n + 1):
		if possible(i, arr):
			ans.append(i)
	print(len(ans))
	for i in ans:
		print(i, end=' ')
main()


n = int(input())
a = [0] + [int(i) for i in input().split()]
x = []
for (ind, a_i) in enumerate(a[1:]):
	x.append(a_i - a[ind])
ans = []
for i in range(1, n + 1):
	flag = 0
	for (ind, j) in enumerate(x):
		if x[ind % i] == j:
			continue
		else:
			flag = 1
			break
	if flag == 0:
		ans.append(i)
print(len(ans))
print(*ans)


a = int(input())
b = list(map(int, input().split()))
ans = []
for i in range(1, a + 1):
	z = 0
	q = 1
	c = []
	for j in range(0, i):
		c.append(b[j] - z)
		z = b[j]
	z = 0
	for j in range(0, a):
		z = z + c[j % i]
		if b[j] != z:
			q = 0
			break
	if q:
		ans.append(i)
print(len(ans))
for i in ans:
	print(i)


n = int(input())
A = [int(x) for x in input().split()]
A = [A[0]] + [A[i] - A[i - 1] for i in range(1, len(A))]
l = []
for i in range(1, len(A) + 1):
	s = A[:i]
	t = [x for x in s]
	e = i
	while A[:e] == t[:e]:
		if len(t) >= len(A):
			l.append(len(s))
			break
		t += t
		e = min(len(t), len(A))
print(len(l))
l.sort()
for x in l:
	print(x, end=' ')
print()


N = int(input())
A = list(map(int, input().split()))
lenA = len(A)
X = [0 for _ in range(N)]
X[0] = A[0]
for i in range(N - 1):
	X[i + 1] = A[i + 1] - A[i]
ans_num = 0
ans_list = []
for i in range(1, N + 1):
	tmp = X[:i]
	ind = i + 1
	ch = 1
	for j in range(0, N, i):
		lens = min(j + i, N) - j
		if tmp[:lens] != X[j:min(j + i, N)]:
			ch = 0
			break
	if ch == 1:
		ans_num += 1
		ans_list.append(i)
print(ans_num)
for i in range(ans_num - 1):
	print(ans_list[i], end=' ')
print(ans_list[-1])


n = int(input())
a = [0] + list(map(int, input().split()))
for i in range(n, 0, -1):
	a[i] -= a[i - 1]
ans = list()
for j in range(1, n + 1):
	flag = 1
	for i in range(1, n - j + 1):
		if a[i + j] != a[i]:
			flag = 0
			break
	if flag:
		ans.append(j)
print(len(ans))
for it in ans:
	print(it, end=' ')


n = int(input())
lis = list(map(int, input().split()))
li = []
li.append(lis[0])
for i in range(1, n):
	li.append(lis[i] - lis[i - 1])
ans = []
for i in range(1, n):
	c = 1
	for j in range(i, n):
		if li[j] != li[j - i]:
			c = 0
			break
	if c:
		ans.append(i)
ans.append(n)
print(len(ans))
print(*ans)


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial
from collections import defaultdict, Counter, OrderedDict, deque
from itertools import combinations, groupby, zip_longest, permutations
from bisect import *
from functools import reduce
from operator import mul
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().strip('\n')
grid = lambda r: [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
n = I()
ls = lint()
(arr, ans) = ([0] * (n - 1), [])
for i in range(1, n):
	arr[i - 1] = ls[i] - ls[i - 1]
arr.insert(0, ls[0])
for i in range(1, n):
	r = n % i
	d = n // i
	if arr[:i] * d + arr[:r] == arr:
		ans.append(i)
ans.append(n)
print(len(ans))
print(*ans)
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


n = int(input())
a = list(map(int, input().split()))
b = [str(a[0])]
for i in range(1, n):
	b.append(str(a[i] - a[i - 1]))
c = []
for i in range(1, n + 1):
	x = len(b[:i])
	p = n // x + 1
	d = b[:i] * (p + 1)
	if d[:n] == b:
		c.append(x)
print(len(c))
print(*c)


def recover(xs):
	arr = [None] * len(xs)
	prev = 0
	for (i, x) in enumerate(xs):
		arr[i] = x - prev
		prev = x
	return arr

def has_cycle(xs, k):
	for i in range(k, len(xs)):
		if xs[i] != xs[i % k]:
			return False
	return True

def min_cycle(xs):
	for i in range(1, len(xs)):
		if has_cycle(xs, i):
			return i
	return len(xs)

def solve(xs):
	n = len(xs)
	arr = recover(xs)
	k = min_cycle(arr)
	solution = set(list(range(k, n, k)) + [n])
	for i in range(k + 1, len(xs)):
		if i not in solution and has_cycle(arr, i):
			solution.add(i)
	return sorted(list(solution))
n = int(input())
xs = list(map(int, input().split()))[:n]
solution = solve(xs)
print(len(solution))
for x in solution:
	print(x, end=' ')
print()


n = int(input())
arr = list(map(int, input().split()))
arr = [0] + arr
ansarr = []
for i in range(1, n + 1):
	valarr = []
	for j in range(1, i + 1):
		val = arr[j] - arr[j - 1]
		valarr.append(val)
		flag = 0
	for j in range(i + 1, n + 1):
		if arr[j] != valarr[(j - 1) % i] + arr[j - 1]:
			flag = 1
			break
	if flag == 0:
		ansarr.append(i)
print(len(ansarr))
print(*ansarr)


arr_len = int(input())
a = [0] + [int(x) for x in input().split(' ')]
x = [0] * arr_len
res = []
for i in range(1, arr_len + 1):
	x[i - 1] = a[i] - a[i - 1]

def ok(k, x, a):
	for i in range(0, arr_len):
		tmp = x[i % k] + a[i]
		if tmp != a[i + 1]:
			return False
	return True
for k in range(1, arr_len + 1):
	if ok(k, x, a):
		res.append(str(k))
import sys
sys.stdout.write(str(len(res)) + '\n')
sys.stdout.write(' '.join(res))