You are given a set S consisting of n+1 non-negative integers, S=0,1,...,n. Also, you have k unlucky integers x1,x2,…xk.
Let's denote the X- misfortune of the set S, f(S,X) --- the number of pairs of integers (a,b) such that a+b=X,a≠b and a∈S,b∈S. RedDreamer has to paint each element of S into one of two colors, white and black, and then create two sets c and d so that all white elements belong to c, and all the black elements belong to d (it is possible that one of these two sets becomes empty). RedDreamer wants to paint the elements in such a way that ∑ki=1|f(c,xi)−f(d,xi)| is minimum possible.
Help RedDreamer to paint the set optimally!
Input format
Note: The sum of n test cases does not exceed 105.
Output format
Let's look to the the 2-test case:
c=0,1,3,4,8;d=2,5,6,7,9,10.
f(c, 7) = 1 (4 and 3). f(d, 7) = 1(2 and 5).
f(c, 8) = 1 (0 and 8). f(d, 8) = 1(2 and 6).
f(c, 9) = 1 (1 and 8). f(d, 8) = 1(2 and 7).
f(c,10)=0;f(d,10)=0.
∑ki=1|f(c,xi)−f(d,xi)|=|1−1|+|1−1|+|1−1|+|0−0|=0.