407566: GYM102830 B Tryouts

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Tryoutstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

In an alternate universe without COVID, tryouts are taking place in person! Participants have come to the auditorium and have gotten seated and are ready to code.

The auditorium has a grid of chairs, with 26 rows and 26 columns. A seat can be identified by a pair of coordinates $$$(x, y)$$$, where $$$0 \le x, y \le 25$$$. Now, a student sitting in a seat would be considered surrounded if there are also students directly to his left, right, front and back. In our world, that would be really bad for socially distancing.

Determine how many students in this auditorium are surrounded, given all the students' coordinates!

Input

The first line of the input contains a single integer $$$n (1 \le n \le 500)$$$, the number of students in the auditorium.

The next $$$n$$$ lines each contain a coordinate $$$(x, y)$$$ of a single student.

Output

Output a single integer, the number of students that are surrounded.

ExampleInput
8
1 2
2 1
2 2
2 3
3 1
3 2
3 3
4 2
Output
2

加入题单

算法标签: