시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 3855 644 511 21.124%

문제

트럭을 타고 이동하던 상근이는 경찰의 검문을 받게 되었다. 경찰은 상근이가 운반하던 화물을 하나하나 모두 확인할 것이기 때문에, 검문하는데 엄청나게 오랜 시간이 걸린다.

상근이는 시간을 때우기 위해서 수학 게임을 하기로 했다.

먼저 근처에 보이는 숫자 N개를 종이에 적는다. 그 다음, 종이에 적은 수를 M으로 나누었을 때, 나머지가 모두 같게 되는 M을 모두 찾으려고 한다. M은 1보다 커야 한다.

N개의 수가 주어졌을 때, 가능한 M을 모두 찾는 프로그램을 작성하시오.

입력

첫째 줄에 종이에 적은 수의 개수 N이 주어진다. (2 ≤ N ≤  100)

다음 줄부터 N개 줄에는 종이에 적은 수가 하나씩 주어진다. 이 수는 모두 1보다 크거나 같고, 1,000,000,000보다 작거나 같은 자연수이다. 같은 수가 두 번 이상 주어지지 않는다.

항상 M이 하나 이상 존재하는 경우만 입력으로 주어진다.

출력

첫째 줄에 가능한 M을 공백으로 구분하여 모두 출력한다. 이때, M은 증가하는 순서이어야 한다.

예제 입력 1

3
6
34
38

예제 출력 1

2 4
W3sicHJvYmxlbV9pZCI6IjI5ODEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjODBcdWJiMzgiLCJkZXNjcmlwdGlvbiI6IjxwPlx1ZDJiOFx1YjdlZFx1Yzc0NCBcdWQwYzBcdWFjZTAgXHVjNzc0XHViM2Q5XHVkNTU4XHViMzU4IFx1YzBjMVx1YWRmY1x1Yzc3NFx1YjI5NCBcdWFjYmRcdWNjMzBcdWM3NTggXHVhYzgwXHViYjM4XHVjNzQ0IFx1YmMxYlx1YWM4YyBcdWI0MThcdWM1YzhcdWIyZTQuIFx1YWNiZFx1Y2MzMFx1Yzc0MCBcdWMwYzFcdWFkZmNcdWM3NzRcdWFjMDAgXHVjNmI0XHViYzE4XHVkNTU4XHViMzU4IFx1ZDY1NFx1YmIzY1x1Y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