K. Knights In The Board
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

In the world of chess, the knight moves in an L-shape: two squares in one direction and then one square perpendicular, or one square in one direction and then two squares perpendicular. This unique movement allows it to jump over other pieces, reaching eight possible squares from a central position on an empty board.

Possible moves of a knight in a chess board

Given a chessboard of size $$$N \times N$$$ and $$$K$$$ knights placed on it, determine the minimum number of knights that must be removed from the board so that no two knights are attacking each other. A knight is considered to be attacking another knight if it can move to the square occupied by the second knight in one turn based on its L-shaped movement pattern.

Input

The first line of input contains two integer numbers separated by a space $$$N$$$ ($$$3 \leq N \leq 25$$$), and $$$K$$$ ($$$1 \leq K \leq N*N$$$), representing the size of the board, and the number of knights in the board.

Each of the following $$$K$$$ lines contains two integer numbers $$$r_i$$$, $$$c_i$$$, representing the $$$i$$$-th knight is placed on row $$$r_i$$$ and column $$$c_i$$$ in the board. No two knights will be places on the same position.

Output

Output a line with an integer number, the minimum number of knights that should be removed from the board so that no two knights are attacking each other.

Examples
Input
3 4
1 1
1 2
2 1
2 2
Output
0
Input
5 9
3 3
1 2
2 1
1 4
2 4
4 1
5 2
4 5
5 4
Output
2
Input
3 9
1 1
2 3
3 1
3 2
3 3
1 2
1 3
2 1
2 2
Output
4