Minimum difference - MarisaOJ: Marisa Online Judge

Minimum difference

Time limit: 1000 ms
Memory limit: 256 MB
You are given an array A of n integers. Divide A into 2 sets of numbers so that the absolute difference in their sum is as small as possible. ### Input - The first line contains an integer n. - The second line contains n integers Ai. ### Output - Print the minimum difference. ### Constraints - 1≤n≤40. - −109≤Ai≤109. ### Example Input: 3124 Output: 1