e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

Azərbaycan Respublika Olimpiadasının yarımfinalı 2018-2019

Bishops

The bishop in chess is a piece that attacks all squares on the same diagonal (on both diagonals).

39s6y2.jpg

Shakhriyar placed m bishops on a chessboard of size n * n. Now he wants to count the number of squares that are not attacked by bishops. Help Shahriyar in this matter.

Input

First line contains two integers: the size n (1n106) of a chessboard and the number of bishops m (1m105). Each of the next m lines contains pair of integers: ri и ci (1ri, cin) - the numbers of row and column where the bishop number i is located. The bishops are numbered from 1 to m. All bishops are located on different squares.

Output

Print the number of squares not attacked by the bishops.

Time limit 1 second
Memory limit 128 MiB
Input example #1
10 6
4 7
8 5
8 7
6 2
9 7
8 4
Output example #1
33
Input example #2
6 1
5 4
Output example #2
28
Input example #3
8 2
4 3
5 6
Output example #3
42
Source Semifinals, Azerbaijan Olympiad 2018-2019