#4592. abc388c镜饼
abc388c镜饼
Problem Statement
There are mochi (rice cakes) arranged in ascending order of size. The size of the -th mochi is .
Given two mochi and , with sizes and respectively, you can make one kagamimochi (a stacked rice cake) by placing mochi on top of mochi if and only if is at most half of .
You choose two mochi out of the mochi, and place one on top of the other to form one kagamimochi.
Find how many different kinds of kagamimochi can be made.
Two kagamimochi are distinguished if at least one of the mochi is different, even if the sizes of the mochi are the same.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Sample Input 1
6
2 3 4 4 7 10
Sample Output 1
8
The sizes of the given mochi are as follows:
In this case, you can make the following eight kinds of kagamimochi:
Note that there are two kinds of kagamimochi where a mochi of size is topped by a mochi of size , and two kinds where a mochi of size is topped by a mochi of size .
Sample Input 2
3
387 388 389
Sample Output 2
0
It is possible that you cannot make any kagamimochi.
Sample Input 3
32
1 2 4 5 8 10 12 16 19 25 33 40 50 64 87 101 149 175 202 211 278 314 355 405 412 420 442 481 512 582 600 641
Sample Output 3
388