label 1,2,3,4,5,6,7,8,9,10,11,12,13;
label 14,15,16,17,18,19,20,21,22,23,24,25;
var  g,i,j,l,k,n,s,v,z:longint;a,b,x,y:array[1..200000]of longint;
q,w:text;
begin
assign(q,'broscute.in');
reset(q);
assign(w,'broscute.out');
rewrite(w);
readln(q,n,k);
if (n<3)or(n>1000)then goto 1;
if (k<2)or(k>200000) then goto 1;
for i:=1 to k do begin
readln(q,x[i],y[i]);
end;
{for i:=1 to k do begin
a[i]:=x[i];b[i]:=y[i];end;}
for i:=1 to 4 do begin
for j:=1 to 4 do begin
for g:=0 to n do begin
if(i=j) then goto 2;
z:=x[j];v:=y[j];
for l:=1 to n do begin
if (z>n)or(v>n) then goto 2;
if(x[i]+g>n)or(y[i]+g>n) then goto 4;
if(x[i]+g=z)and(y[i]+g=v) then begin s:=s+1;goto 3;end;
z:=z+1;v:=v+1;
end;2:end;
3:end;4:end;
for i:=1 to 4 do begin
for j:=1 to 4 do begin
for g:=0 to n do begin
if(i=j) then goto 5;
z:=x[j];v:=y[j];
for l:=1 to n do begin
if (z>n)or(v>n) then goto 5;
if(x[i]-g>n)or(y[i]-g>n) then goto 7;
if(x[i]-g=z)and(y[i]-g=v) then begin s:=s+1;goto 6;end;
z:=z+1;v:=v+1;
end;5:end;
6:end;7:end;
for i:=1 to 4 do begin
for j:=1 to 4 do begin
for g:=0 to n do begin
if(i=j) then goto 8;
z:=x[j];v:=y[j];
for l:=1 to n do begin
if (z>n)or(v>n) then goto 8;
if(x[i]+g>n)or(y[i]-g>n) then goto 10;
if(x[i]+g=z)and(y[i]-g=v) then begin s:=s+1;goto 9;end;
z:=z+1;v:=v+1;
end;8:end;
9:end;10:end;
writeln(w,s);
1:close(q);
close(w);
end.

