#CF2236A. 火车上的游戏 / A. Games on the Train
火车上的游戏 / A. Games on the Train
A. Games on the Train
Source: Codeforces 2236A
Contest: Codeforces Round 1103 (Div. 3)
Time limit: 1 second
Memory limit: 256 megabytes
Statement
Dabir, Egor, and Arseniy just got on the train and decided to play a game. Dabir has a backpack with an infinite number of cubes. He built towers from them, where the -th tower has height cubes.
Egor and Arseniy must choose an integer for each tower and increase its height by exactly once. For example, if = [], = [], then after increasing it will become []. Their goal is to make the heights of all towers equal.
To make the game more interesting, Dabir wants to choose an integer and add a restriction: each must satisfy . Help him find the smallest for which it is possible to finish the game.
Input
The first line contains a single integer () — the number of test cases.
Then test cases follow.
The first line of each test case contains a single integer ().
The second line contains integers ().
Output
For each test case, output a single integer — the minimum value of such that it is possible to make all towers have equal height.
Examples
4
2
1 3
3
2 6 4
5
5 4 6 6 1
4
3 3 3 3
3
5
6
1