atcoder#AGC003B. [AGC003B] Simplified mahjong
[AGC003B] Simplified mahjong
Score : points
Problem Statement
Snuke has a large collection of cards. Each card has an integer between and , inclusive, written on it. He has cards with an integer .
Two cards can form a pair if the absolute value of the difference of the integers written on them is at most .
Snuke wants to create the maximum number of pairs from his cards, on the condition that no card should be used in multiple pairs. Find the maximum number of pairs that he can create.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
:
Output
Print the maximum number of pairs that Snuke can create.
4
4
0
3
2
4
For example, Snuke can create the following four pairs: .
8
2
0
1
6
0
8
2
1
9