#K75217. Minimum Difference Partition

    ID: 34371 Type: Default 1000ms 256MiB

Minimum Difference Partition

Minimum Difference Partition

Given a set of N integers, your task is to partition them into two groups such that the absolute difference between the sums of the two groups is minimized. In other words, if the two groups have sums \(S_1\) and \(S_2\) respectively, you need to minimize \(|S_1 - S_2|\).

You are required to read input from stdin and output the result to stdout.

inputFormat

The first line contains an integer N, representing the number of integers.

The second line contains N space-separated integers.

outputFormat

Output a single integer which is the minimum absolute difference between the sums of the two groups.

## sample
5
1 2 3 4 5
1