Shubham is preparing for ACM - ICPC contest.He has solved a good number of problems and now he is confident enough to clear the online round of the main contest. Online round is a few days ahead from now so Shubham asks his friends Abhishek and Tushar to give him a problem, so that he can test himself.
Abhishek and Tushar both have come up with a problem in which Abhishek gives an array of integers (let A denotes the array) to Shubham(number of elements in this array is even).
Let N denote the number of elements in the array (A).
Now Tushar further tells Shubham to convert this array ’A’ into a sequence S such that S has N/2 elements and each element of S should be given by sum of 2 elements of array ‘A’ present at different positions. Also each element of ‘A’ should contribute to exactly one element of S. i.e. any element of array ‘A’ cannot be used more than once while generating S.
‘X’ denotes an integer that divides all the elements of S. i.e. for all 0 <= i <N/2 S[i]%X == 0.
Abhishek and Tushar want Shubham to find the largest possible value of X for the given array A.
Help Shubham to solve this problem.
1) 2<= N <=30 and N is even.
2) 1<= Arr[i] <= 10^9
1) First line contains N denoting the number of elements in the array given by Abhishek.
2) Second line contains N spaced integers denoting Elements of the array.
Print the largest possible value of X as discussed in the problem statement.
For the given test case:
A = [ 5 ,4 ,13 ,2]
For largest possible X,
S = {5+13 , 4+2} = { 18 ,6}
X = 6