#P9350. Influence Spread in JOI Kingdom

    ID: 22503 Type: Default 1000ms 256MiB

Influence Spread in JOI Kingdom

Influence Spread in JOI Kingdom

There are \(N\) residents in JOI Kingdom, numbered from \(1\) to \(N\). Resident \(i\) (\(1 \le i \le N\)) lives at coordinate \(X_i\) on the real line and has a power of influence \(E_i\). Note that more than one resident may live at the same coordinate.

Rie published a book on informatics. In order to maximize its readership, she may donate copies of the book to some residents. If she donates a copy to Resident \(i\), then Resident \(i\) immediately gets the book. Moreover, simultaneously among those residents who have not received a copy, every resident \(j\) (\(1 \le j \le N\)) satisfying the following condition will buy the book:

[ |X_i - X_j| \le E_i - E_j ]

In other words, if Resident \(i\) is given a donated copy, then every resident \(j\) who has not yet gotten a copy will purchase one if \(E_i \ge E_j + |X_i - X_j|\) holds.

Your task is to choose a set \(S\) of residents to donate such that, after the donation and the triggered purchases, every resident in the Kingdom ends up having a copy of the book. Determine the minimum number of residents that must be chosen for donation.

Note: Residents who buy a copy as a result of another resident’s donation do not trigger further purchases.

inputFormat

The input begins with a line containing a single integer \(N\) \((1 \le N \le 20)\), the number of residents.

Then \(N\) lines follow. The \(i\)-th line contains two integers \(X_i\) and \(E_i\) separated by a space representing the coordinate and influence power of Resident \(i\), respectively. It is guaranteed that \(X_i\) and \(E_i\) are within reasonable limits.

outputFormat

Output a single integer: the minimum number of residents to whom Rie must donate a copy so that, after the triggered purchases, every resident in JOI Kingdom ends up with a copy of the book.

sample

3
0 3
2 1
4 0
2