#d2914. 一半相等

一半相等

Half Equal

Problem Description

You are given an array a1,a2,…,ana_1, a_2, \dots, a_n of nn integers (nn is even).

Consider such a kk. In one operation you choose an index ii and decrease aia_i by kk. After performing several operations (possibly 00), at least half of the elements in the array become equal. Find the largest such kk; if kk can be arbitrarily large, output −1-1.

Input Format

The input consists of two lines. The first line is a positive integer nn, the size of the array. The second line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n.

Output Format

Output the kk described in the problem statement.

Sample Input

8
-1 0 1 -1 0 1 -1 0

Sample Output

2

Constraints

4≤n≤1004 \leq n \leq 100, it is guaranteed that nn is even.

−106≤ai≤106-10^6 \leq a_i \leq 10^6.