Noisy Neighbors#3010

Noisy Neighbors

1 second
64 megabytes
Medium

In a fairy-tale land, there are dwarfs. Their houses are located along a straight line. Each dwarf owns a musical instrument and enjoys playing it. However, each dwarf believes only they are a true musician. Therefore, if a dwarf hears music from any other dwarf besides their own, they become very upset, feeling disturbed. In such cases, the dwarf files a complaint to the king about every other dwarf whose music they can hear.

Write a program to determine the total number of complaints the king will receive.

Input

The first line contains an integer (1 \leq N \leq 10^5). Each of the next lines contains two integers x_i and r_i (-10^9 \leq x_i \leq 10^9, 0 \leq r_i \leq 10^9), representing the position of the dwarf's house and the maximum distance their music can be heard, respectively.

Output

Print the number of complaints in a single line.

Examples

Example 1

Loading
Loading