#P1043B. Lost Array

Lost Array

No submission language available for this problem.

Description

Bajtek, known for his unusual gifts, recently got an integer array x0,x1,,xk1x_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 aa of length n+1n + 1. As a formal description of aa says, a0=0a_0 = 0 and for all other ii (1in1 \le i \le n) ai=x(i1)modk+ai1a_i = x_{(i-1)\bmod k} + a_{i-1}, where pmodqp \bmod q denotes the remainder of division pp by qq.

For example, if the x=[1,2,3]x = [1, 2, 3] and n=5n = 5, then:

  • a0=0a_0 = 0,
  • a1=x0mod3+a0=x0+0=1a_1 = x_{0\bmod 3}+a_0=x_0+0=1,
  • a2=x1mod3+a1=x1+1=3a_2 = x_{1\bmod 3}+a_1=x_1+1=3,
  • a3=x2mod3+a2=x2+3=6a_3 = x_{2\bmod 3}+a_2=x_2+3=6,
  • a4=x3mod3+a3=x0+6=7a_4 = x_{3\bmod 3}+a_3=x_0+6=7,
  • a5=x4mod3+a4=x1+7=9a_5 = x_{4\bmod 3}+a_4=x_1+7=9.

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

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

The first line contains exactly one integer nn (1n10001 \le n \le 1000) — the length of the array aa, excluding the element a0a_0.

The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1061 \le a_i \le 10^6).

Note that a0a_0 is always 00 and is not given in the input.

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

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

Input

The first line contains exactly one integer nn (1n10001 \le n \le 1000) — the length of the array aa, excluding the element a0a_0.

The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1061 \le a_i \le 10^6).

Note that a0a_0 is always 00 and is not given in the input.

Output

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

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

Samples

Sample Input 1

5
1 2 3 4 5

Sample Output 1

5
1 2 3 4 5

Sample Input 2

5
1 3 5 6 8

Sample Output 2

2
3 5

Sample Input 3

3
1 5 3

Sample Output 3

1
3

Note

In the first example, any kk is suitable, since aa is an arithmetic progression.

Possible arrays xx:

  • [1][1]
  • [1,1][1, 1]
  • [1,1,1][1, 1, 1]
  • [1,1,1,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 xx:

  • [1,2,2][1, 2, 2]
  • [1,2,2,1,2][1, 2, 2, 1, 2]

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

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

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

Note that xix_i may be negative.