#include <cstdio>
#define nmax 1003
using namespace std;
long j, n, k, i, l, c, d1a, d2a, rez, nd1[nmax+nmax], nd2[nmax+nmax+nmax];
bool ma[nmax][nmax];

int main()
{
	freopen("broscute.in","r",stdin);
	freopen("broscute.out","w",stdout);
	scanf("%ld %ld",&n, &k);
	for (i=1;i<=k;i++)
	{
		scanf("%ld %ld",&l, &c);
		nd1[l+c]++;	nd2[c-l+n]++;	ma[l][c]++;
	}
	for (i=1;i<=n;i++)
		for (j=1;j<=n;j++)
		{
			d1a=i+j;	d2a=j-i+n;
			if ( (ma[i][j]==1) && ((nd1[d1a]>=2) || (nd2[d2a]>=2)) )
				rez++;
			else
				if ((nd1[d1a]>=1)&&(nd2[d2a]>=1)&& (ma[i][j]==0))
					rez++;
		}
	printf("%ld\n",rez);
	return 0;
}
