#include <fstream>
using namespace std;

const int N=4005,M=1001;
int etc[2*N],*dsp=etc+N+1,dss[2*N],n,nr;
bool frog[M][M];

ifstream in("broscute.in");
ofstream out("broscute.out");

inline bool ok(bool frog,int x,int y)
{
	return !frog && x && y || frog && (x>1 || y>1);
}

int main()
{
	int k,i,j,x,y;
	in>>n>>k;
	while (k--)
	{
		in>>x>>y;
		dsp[x-y]++;
		dss[x+y]++;
		frog[x][y]=true;
	}
	for (i=1;i<=n;i++)
		for (j=1;j<=n;j++)
			if (ok(frog[i][j],dsp[i-j],dss[i+j]))
				nr++;
	out<<nr<<"\n";
	return 0;
}
