You have a number of stones with known weights W1, …, Wn. Write a program that will rearrange the stones into two piles such that weight difference between the piles is minimal.
Input
Input contains the number of stones N (1 = N = 20) and weights of the stones W1, …, Wn (integers, 1 = Wi = 100000) delimited by white spaces.
Output
Your program should output a number representing the minimal possible weight difference between stone piles.
Sample
Input
5
5 8 13 27 14
Output
3