eolymp
bolt
Try our new interface for solving problems

Count

Time limit 1 second
Memory limit 64 MiB

Given is a sequence of n integers: a[1], a[2] ,..., a[n]. Given is also an integer v. We considerpairs (a[i] , a[j] ) of elements from the given sequence, such that i < j.

Write a program that finds such pair, whose sum (a[i] + a[j]) is the closest to (or thesame as) the value of v and output the number of all such pairs with sums (a[i] + a[j]) that areequally closest to the value of v.

####InputOn the first line of the standard input, the value of n is written.On the second line, the values of a[1] , a[2] , ... , a[n], are written, separated by space.On the third line, the value of v is written.

####OutputOn the standard output, your program has to print one integer, equal to the wantedcount of pairs.

###Constraints

  • 1 < n10^6 ;

  • −10^4a[i]10^4 (1in)

  • −10^4v10^4 .

####Explanation for the first sample caseThe value v = 12 cannot be obtained as a sum of elements of some considered pairs. But 13 can, e.g. 2 + 11 = 13. So, distance between v = 12 and 13 is 1. There exist some other pairs of elements, which sum is at distance 1 from v = 12.They are: 2 + 9 = 11, 2 + 9 = 11, 5 + 8 = 13. The total number of pairs with sum 11 or 13 is 4.Pay attention that the pair (2, 9) is count twice, because in the given sequence there are twodifferent pairs of elements, although of equal value (2, 9).

Examples

Input example #1
9
2 5 8 9 9 11 12 15 16
12

Output example #1
4