This page is still under construction.

Parts of this page are still being built. What you see may change.

Bridge Pillars

Time limit1sMemory limit128 MB

Summary
Pick a modulus m above 1 that keeps the largest group of pillar heights sharing one remainder, with ties broken toward the larger m.
Level

Medium7 of 10

Topics
Number theory, Prefix sum
Solved
No attempts yet

Problem

Engineer Bajtazar wants to build a bridge across a canyon. The bridge rests on massive concrete pillars shaped like cylinders.

Each pillar has a positive integer height (measured in bytemeters). For the bridge to be level, every pillar must stick out above the ground by the same height (at least one bytemeter). Assume the ground under the bridge has already been perfectly leveled.

Each pillar is also sunk into the ground by a non-negative integer number of bytemeters, or its base rests directly on the ground (a buried length of 00). Building regulations require that every buried length be a multiple of some natural number mm, and mm must be greater than 11. This mm is the strength coefficient of the bridge.

Not all delivered pillars have to be used. Bajtazar wants to use as many pillars as possible, so he picks mm so that as many pillars as possible have heights leaving the same remainder when divided by mm. (If every used pillar sticks out by the same height PP, then each buried length equals its height minus PP, and for all of these to be multiples of mm the used heights must all share the same remainder modulo mm.) If several values of mm give the same maximum count, he chooses the largest such mm.

Input

The first line contains an integer nn (2≤n≤100 0002 \le n \le 100\,000), the number of delivered pillars. The second line contains nn integers wiw_i (1≤wi≤10 000 0001 \le w_i \le 10\,000\,000), the heights of the pillars, separated by spaces. You may assume the pillars do not all have the same height.

Output

Print two integers kk and mm on one line: kk is the maximum number of pillars that can be used for the bridge, and mm is the largest possible strength coefficient of a kk-pillar bridge. You may assume such an mm exists.

Examples1

  1. Example 1

    Input
    6
    7 4 10 8 7 1
    
    Expected output
    5 3