eolymp
bolt
Try our new interface for solving problems

Game

Vova plays a very exciting game on the computer, which is called "Robot and Treasure." In this game on an endless checkered field in some cells treasure chests are located. The player is invited to control the robot, which must first be put in one of the cells, and then collect all the treasures. The robot takes valuable material objects when it is with them in one cell. The robot can move to any of the 8 neighboring cells. He does this by pressing a special key on the keyboard.

Recently, Vova suffered trouble. He lost several keys on the keyboard, but he still managed to collect all the treasures. Now Vova is interested in the question of how many keys he can spoil so that he can still be able to collect all the treasures.

Input

First line contains one integer n (1n1000) - number of boxes with jewels. Next given n lines, 2 integers in a line - the coordinates of the next chest. These numbers do not exceed 105 by absolute value.

Output

Print one number - the maximum number of keys that can be spoiled.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4
0 0
2 0
0 2
2 2
Output example #1
6
Input example #2
4
-1  0
2 0
2 2
0 2
Output example #2
6
Source 2008 Цикл интернет-олимпиад для школьников. Пятая индивидуальная олимпиада, December 20, Problem A