#P6817. [PA 2013] Filary

[PA 2013] Filary

Problem Description

Given a sequence aa of length nn, choose kk numbers such that these kk numbers have the same remainder modulo mm, where m2m\geq 2.

Find the maximum possible kk, and under the condition that kk is maximized, maximize mm.

Input Format

The first line contains a positive integer nn.

The second line contains nn positive integers representing the sequence aa.

Output Format

Output one line with two numbers k,mk,m.

6
7 4 10 8 7 1
5 3

Hint

Constraints: 2n1052\leq n\leq 10^5, 1ai1071\leq a_i\leq 10^7. It is guaranteed that a solution exists, and it is guaranteed that not all aia_i are equal.

Translated by ChatGPT 5