#include<cstdio>
using namespace std;


int rez,s,p,q,x,y,n,k,a[10000],b[10000];

bool w[1001][1001];

int main()
{
	int i,j;
	freopen("broscute.in","r",stdin);
	freopen("broscute.out","w",stdout);
	scanf("%d%d",&n,&k);
	for(i=1;i<=k;++i)
	{
		scanf("%d%d",&x,&y);
		w[x][y]=true;
		if (x<=y)
			a[y-x]++;
		else
			a[x-y+n-1]++;
		if (x>=n-y+1)
			b[x-(n-y+1)]++;
		else
			b[n-y+1-x+n-1]++;
	}
	for(i=1;i<=n;++i)
		for(j=1;j<=n;++j)
		{
			x=i;
			y=j;
			if (x<=y)
				p=y-x;
			else
				p=x-y+n-1;
			if (x>=n-y+1)
				q=x-(n-y+1);
			else
				q=n-y+1-x+n-1;
			if(a[p]!=0 && b[q]!=0)
				s=a[p]*b[q];
			else
				s=0;
			if(w[x][y]==true)
				--s;
			if(s!=0)
			{
				++rez;
			}
		}
	printf("%d\n",rez);
	return 0;
}