Game#607

Game

1 second
128 megabytes
Hard

Vova plays a very exciting game on the computer called Robot and Treasure. In this game, on an infinite checkered field, treasure chests are located in some of the cells. The player is invited to place the robot in any cell and then control it to collect all the treasures. The robot collects valuable objects from the cell it occupies. The robot can move to any of the neighboring cells by pressing a special key on the keyboard.

Recently, Vova faced trouble. Several keys on his keyboard broke, but he still managed to collect all the treasures. Now Vova wants to know: what is the maximum number of keys that can be spoiled while still being able to collect all the treasures in any case?

Input

The first line contains an integer (1 \le n \le 1000) — the number of chests with treasures. The following lines each contain two integers — the coordinates of each chest. All numbers do not exceed 10^5 in absolute value.

Output

Print one integer — the maximum number of keyboard keys that can be broken.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading