You are given a sequence a_1, a_2, ..., a_n consisting of n integers.

You can choose any non-negative integer D (i.e. D ≥ 0), and for each a_i you can:

  * add D (only once), i. e. perform a_i := a_i + D, or 
  * subtract D (only once), i. e. perform a_i := a_i - D, or 
  * leave the value of a_i unchanged. 



It is possible that after an operation the value a_i becomes negative.

Your goal is to choose such minimum non-negative integer D and perform changes in such a way, that all a_i are equal (i.e. a_1=a_2=...=a_n).

Print the required D or, if it is impossible to choose such value D, print -1.

For example, for array [2, 8] the value D=3 is minimum possible because you can obtain the array [5, 5] if you will add D to 2 and subtract D from 8. And for array [1, 4, 7, 7] the value D=3 is also minimum possible. You can add it to 1 and subtract it from 7 and obtain the array [4, 4, 4, 4].

Input

The first line of the input contains one integer n (1 ≤ n ≤ 100) — the number of elements in a.

The second line of the input contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 100) — the sequence a.

Output

Print one integer — the minimum non-negative integer value D such that if you add this value to some a_i, subtract this value from some a_i and leave some a_i without changes, all obtained values become equal.

If it is impossible to choose such value D, print -1.

Examples

Input


6
1 4 4 7 4 1


Output


3


Input


5
2 2 5 2 5


Output


3


Input


4
1 3 3 7


Output


-1


Input


2
2 8


Output


3
"""
- math -
from math import factorial
from math import gcd
from math import pi
large_p = 10**9 + 7
from itertools import accumulate # 累積和
from operator import mul
- other -
from collections import Counter
from itertools import combinations
from itertools import combinations_with_replacement
from itertools import permutations
from operator import itemgetter
from functools import reduce
- list -
from copy import deepcopy
from collections import deque
from heapq import heapify, heappop, heappush
- output -
p2d = lambda x: print(*x, sep="\n")
p2line = lambda x: print(*x, sep=" ")
print(*list1, sep="\n")
- input -
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
= map(int, input().split())
= [tuple(map(int, input().split())) for _ in range(n)]
= [tuple(map(int, readline().split())) for _ in range(n)]
m = map(int, read().split()) /ab = zip(m, m) /for a, b in ab:
ps = [line.split() for line in readlines()] # inputの最後まで読んでしまうので注意。
n, *a = map(int, read().split())
a = list(map(int, readlines()))
- run -
sys.setrecursionlimit(10**6)
from time import sleep
"""
# ATC04

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    n, *a = map(int, read().split())

    for i1 in range(0, 101):
        d = [[0] * n for _ in range(301)]
        dic1 = defaultdict(int)
        a1 = [i + i1 for i in a]
        a2 = [i - i1 for i in a]
        cnt = 0
        for p1, p2, p3 in zip(a, a1, a2):
            d[p1+100][cnt] = 1
            d[p2+100][cnt] = 1
            d[p3+100][cnt] = 1
            cnt += 1
        for i2 in range(301):
            if all(d[i2]):
                print(i1)
                sys.exit()
    print(-1)

if __name__ == '__main__':
    main()

"""
def main():
    n, *a = map(int, read().split())

    for i1 in range(0, 101):
        d = [[0] * 101 for _ in range(n)]
        dic1 = defaultdict(int)
        a1 = [i + i1 for i in a]
        a2 = [i - i1 for i in a]
        cnt = 0
        for p1, p2, p3 in zip(a, a1, a2):
            dic1[p1] += 1
            dic1[p2] += 1
            dic1[p3] += 1
            cnt += 1
        if max(dic1.values()) == n:
            print(i1)
            sys.exit()
    print(-1)

"""