#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,k;
struct Broscuta{short x,y; bool c;};
Broscuta v[200010];
int sol;
bool uz[1010][1010];

inline bool Ordonare(const Broscuta A,const Broscuta B)
{
	if(A.x==B.x)
		return A.y<B.y;
	return A.x<B.x;
}

int main()
{
	int i,j,xb,yb,xb1,yb1,xv,yv,xi,yi;
	int dx1,dx2,dy1,dy2;
	long long r1,r2;
	freopen("broscute.in","r",stdin);
	scanf("%d",&n);
	scanf("%d",&k);
	for(i=1;i<=k;i++)
	{
		scanf("%d",&xb);
		scanf("%d",&yb);
		v[i].x=xb;
		v[i].y=yb;
		if((xb+yb)%2==0)
			v[i].c=true;
	}
	sort(v+1,v+k+1,Ordonare);
	//for(i=1;i<=k;i++)
	//	cout<<v[i].x<<' '<<v[i].y<<' '<<v[i].c<<"\n";
	dx1=n-1;
	dy1=n-1;
	dx2=n-1;
	dy2=1-n;
	for(i=1;i<k;i++)
	{
		for(j=i+1;j<=k;j++)
		{
			if(v[i].c==v[j].c)  //daca se afla pe diagonale de aceeasi culoare
			{
				xb=v[i].x;
				yb=v[i].y;
				xb1=v[j].x;
				yb1=v[j].y;
				//daca se afla pe aceeasi diagonala
				xv=xb1-xb;
				yv=yb1-yb;
				r1=xv;
				r1*=dy1;
				r2=yv;
				r2*=dx1;
				if(r1==r2)
				{
					if(uz[xb][yb]==false)
					{
						sol++;
						uz[xb][yb]=true;
					}
					if(uz[xb1][yb1]==false)
					{
						sol++;
						uz[xb1][yb1]=true;
					}
				}
				else
				{
					r1=xv;
					r1*=dy2;
					r2=yv;
					r2*=dx2;
					if(r1==r2)
					{
						if(uz[xb][yb]==false)
						{
							sol++;
							uz[xb][yb]=true;
						}
						if(uz[xb1][yb1]==false)
						{
							sol++;
							uz[xb1][yb1]=true;
						}
					}
					else //daca nu se afla pe aceeasi diagonala
					{
						//intersectia 1
						xi=(xb+yb+xb1-yb1)/2;
						yi=xi+yb1-xb1;
						if(xi>0 && xi<=n && yi>0 && yi<=n)
						{
							if(uz[xi][yi]==false)
							{
								sol++;
								uz[xi][yi]=true;
							}
						}
						//intersectia 2
						xi=(xb1+yb1+xb-yb)/2;
						yi=xi+yb-xb;
						if(xi>0 && xi<=n && yi>0 && yi<=n)
						{
							if(uz[xi][yi]==false)
							{
								sol++;
								uz[xi][yi]=true;
							}
						}
					}
				}
			}
		}
	}
	freopen("broscute.out","w",stdout);
	printf("%d\n",sol);
	return 0;
}
