Princess Celestia and Princess Luna argued, and the spreading darkness could be transformed into the following model:
In an infinitely large white 2D grid, there are initially $$$n$$$ black grid points.
Every second, all white points that are 4-neighbors of at least two black points will turn black.
What is the total number of black points in the end?
The first line contains an integer $$$n$$$ $$$(1\le n\le 10^5)$$$, representing the total number of grid points.
The next $$$n$$$ lines each contain two integers $$$a$$$ and $$$b$$$ $$$(-10^{9}\le a,b\le 10^9)$$$, representing the positions of black grid points. The black points are guaranteed to be distinct from each other.
Output a single integer representing the total number of black points in the end.
7 1 1 1 4 2 2 3 4 5 5 6 7 7 6
21
The change of the grid over time is shown below. After Time $$$6$$$ no more grid will turn black, so the answer is $$$21$$$.
| Название |
|---|


