label 1;
var f,g:text;
a:array[1..100,1..100] of integer;
x,y:array[1..100] of integer;
t,i,j,n,k,s,d,p,l:longint;
begin
 assign(f,'broscute.in');reset(f);
read(f,n,k);
for i:=1 to k do read(f,x[i],y[i]);
for i:=1 to n do
for j:=1 to n do
for p:=1 to k do if (i+j=x[p]+y[p]) or (i-j=x[p]-y[p]) then inc(a[i,j]);

for i:=1 to k-1 do
for j:=i+1 to k do begin
if x[i]+y[i]=x[j]+y[j] then begin s:=s+2;for t:=1 to n do for l:=1 to n do if t+l=x[i]+y[i] then a[t,l]:=a[t,l]-1;end;
if x[i]-y[i]=x[j]-y[j] then begin s:=s+2;for t:=1 to n do for l:=1 to n do if t-l=x[i]-y[i] then a[t,l]:=a[t,l]-1;end;
end;
assign(g,'broscute.out');rewrite(g);
1:for i:=1 to n do for j:=1 to n do if a[i,j]>1 then s:=s+1;

writeln(g,s);
close(f);close(g);
end.

