#include<cstdio>
#define InFile "broscute.in"
#define OutFile "broscute.out"

using namespace std ;

int diagSec[2002], subD[1001], peD[1001] ;
int n, nrTotal ;
char a[1001][1001] ;

void Citire()
{
	int i, p, q, k ;
	freopen(InFile, "r", stdin) ;
	scanf("%d %d", &n, &k) ;
	for (i = 1 ; i <= k ; i++)
	{
		scanf("%d %d", &p, &q) ;
		a[p][q] = '1' ;
		diagSec[p + q]++ ;
		if (p >= q) subD[p-q]++ ;
		else peD[q-p]++ ;
	}
}

void Calcul()
{
	int i, j, x1, y1, x2, y2, k, s ;
	
	nrTotal = 0 ;
	// parcurg diag. principala si diagonalele de sub diagonala principala
	for (i = 1 ; i <= n ; i++)
	{
		x1 = i ;
		y1 = 1 ;
		x2 = n ;
		y2 = n - i + 1 ;
		if (subD[x1 - y1] > 0)
		for (j=0, k = x1 + y1 ; k <= x2 + y2 ; j++, k+=2)
			if (diagSec[k] > 0)
			{
				s = subD[x1 - y1] + diagSec[k] ;
				
				if ( (s > 2) || (s == 2 && a[x1+j][k - x1 - j] != '1') )
					nrTotal++ ;
			}
	}
	
	//parcurg diagonalele de deasupra diagonalei principale
	for (i = 2 ; i <= n ; i++)
	{
		x1 = 1 ;
		y1 = i ;
		x2 = n - i + 1 ;
		y2 = n ;
		if (peD[y1 - x1] > 0)
		for (j=0, k = x1 + y1 ; k <= x2 + y2 ; j++, k+=2)
			if (diagSec[k] > 0)
			{
				s = peD[y1 - x1] + diagSec[k] ;
				if ( (s > 2) || (s == 2 && a[x1+j][k - x1 - j] != '1'))
					nrTotal++ ;	
			}
	}
}

void AfisareSolutie()
{
	freopen(OutFile, "w", stdout) ;
	printf("%d\n", nrTotal) ;
}

int main()
{
	Citire() ;
	Calcul() ;
	AfisareSolutie() ;
	
	return 0 ;
}
