1. You are given an array(arr) of integers. 2. You have to divide all the elements of the given array into two sets S1 and S2. 3. You have to find the minimum value of |(sum of all elements of S1) - (sum of all elements of S2)|.
Input Format
A number N arr1 arr2... N integers
Output Format
Check the sample output and question video.
Constraints
1 <= N <= 10^3 1 <= arr[i] <= 10^3
Example
Input
6 1 1 7 8 9 1
Output
3