서로 다른 정수들이 주어질 때, 절반 이상이 같은 나머지 k를 갖도록 하는 m과 k를 찾는다.
보통6수학정수론조합론그리디아직 제출이 없습니다시간 제한1초메모리 제한512 MBIn order to get better results in official ACM ICPC contests, the team leader came up with a questionnaire. He asked every participant whether they want to have more training.
Obviously, many people don't want more training, so the clever leader didn't write down their words such as "Yes" or "No". Instead, he let everyone choose a positive integer a_i to represent their opinion. Amazingly, all the resulting numbers were distinct.
Now the leader wants to choose a pair of positive intergers m (1<m≤109) and k (0≤k<m), and regard those people whose number is exactly k modulo m as "Yes", and all others as "No". If there are at least as many "Yes" answers as "No" answers, the leader can have a chance to offer more training.
Please help the team leader to find such pair of m and k.
The first line of the input contains an integer n: the number of ACM ICPC participants (3≤n≤105).
The next line contains n distinct integers a_1, a_2, …, a_n: the numbers chosen by the participants (1≤a_i≤109).
Print a single line containing two integers m and k. If there are several possible solutions, print any one of them.