You are given an infinite chessboard with $$$N$$$ obstacles placed on it. We call a rook is limited if it can move to only a finite number of squares. Your task is to count how many empty squares on the board will result in a limited rook if you place one there. Note that you cannot place a rook on a square that occupied by an obstacle.
A rook moves any number of squares in the same row or column, but cannot move to or jump over the obstacles. More precisely, a rook placed at square $$$(r, c)$$$ can move to a square $$$(r', c')$$$ only if one of the conditions is satisfied:
The first line of the input contains an integer $$$N$$$, the number of obstacles.
Each of the next $$$N$$$ line contains two integers $$$r_i, c_i$$$, indicating that the $$$i$$$-th obstacle is placed at $$$(r_i, c_i)$$$.
Output a single line with one integer represents the number of squares on the board will result in a limited rook if you place one there.
61 01 50 10 248763 256562 1
2
153 54 15 40 51 20 42 04 53 32 30 20 30 11 13 2
4