#include <cstdio>

//#define CHECK_TIME

#ifdef CHECK_TIME
#include <ctime>
#endif

const char InFile[]="broscute.in";
const char OutFile[]="broscute.out";
const int MaxN=1024;
const int dx[]={1,-1,-1,1};
const int dy[]={1,-1,1,-1};
const int BUFFER_SIZE=200111*12;

FILE *fin=fopen(InFile,"r");
FILE *fout=fopen(OutFile,"w");

int N,K,x,y,sol;
char D1[MaxN][MaxN],D2[MaxN][MaxN],B[MaxN][MaxN];
char buffer[BUFFER_SIZE];
char *ptr=buffer;

inline int get()
{
	int semn=1;
	int val=0;
	while(!('0'<=*ptr && *ptr<='9') && *ptr!='-')
	{
		++ptr;
	}
	if(*ptr=='-')
	{
		semn=-1;
		++ptr;
	}
	while('0'<=*ptr && *ptr<='9')
	{
		val*=10;
		val+=*ptr-'0';
		++ptr;
	}
	return val*semn;
}

int main()
{
#ifdef CHECK_TIME
	int start=clock();
#endif
	fread(buffer,BUFFER_SIZE,1,fin);
	N=get();
	K=get();
	for(register int i=0;i<=N+1;++i)
	{
		B[i][0]=B[i][N+1]=B[0][i]=B[N+1][i]=-1;
	}
	for(register int i=1;i<=K;++i)
	{
		x=get();
		y=get();
		B[x][y]=1;
		if(D1[x][y]<2)
		{
			--D1[x][y];
			for(register int i=0;i<2;++i)
			{
				int tx=x;
				int ty=y;
				while(B[tx][ty]!=-1)
				{
					++D1[tx][ty];
					tx+=dx[i];
					ty+=dy[i];
				}
			}
		}
		if(D2[x][y]<2)
		{
			--D2[x][y];
			for(register int i=2;i<4;++i)
			{
				int tx=x;
				int ty=y;
				while(B[tx][ty]!=-1)
				{
					++D2[tx][ty];
					tx+=dx[i];
					ty+=dy[i];
				}
			}
		}
	}
	fclose(fin);
	
	for(register int i=1;i<=N;++i)
	{
		for(register int j=1;j<=N;++j)
		{
			if(D1[i][j]==2 && B[i][j]==1)
			{
				++sol;
				continue;
			}
			if(D2[i][j]==2 && B[i][j]==1)
			{
				++sol;	
				continue;
			}
			if(D1[i][j]>=1 && D2[i][j]>=1 && B[i][j]!=1)
			{
				++sol;		
				continue;
			}
			if(D1[i][j]==2 && D2[i][j]==2 && B[i][j]==1)
			{
				++sol;		
				continue;
			}
		}
	}
	
	fprintf(fout,"%d",sol);
	fclose(fout);
#ifdef CHECK_TIME
	printf("Time: %lf",(double)(clock()-start)/(double)(CLOCKS_PER_SEC));
#endif
	return 0;
}
