IntermediateRating 1200
Balanced Split Point
Find the position k (1 ≤ k < n) that splits the list into a left part a₁…aₖ and a right part so that |left sum − right sum| is as small as possible. Print that smallest difference.
Input
n (≥ 2), then n integers.
Output
One integer.
Sample 1
Input
4 1 2 3 4
Output
2
Sample 2
Input
2 5 5
Output
0
Output appears here