#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
int s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9')s=s*10+ch-48,ch=getchar();
return s*w;
}
inline void write(int x){
if(x<0)putchar('-'),x=-x;
if(x>9)write(x/10);
putchar(x%10+48);
}
const int N = 1e5 + 10;
int n=read(),k=read(),ans;
bool g[110][110],pack[110][110];
int dx[]={0,0,-1,1,1,-1,-1,1};
int dy[]={1,-1,0,0,1,-1,1,-1};
bool re(int a){
return a>=1&&a<=100;
}
bool check(int x,int y){
int cnt=0;
if(g[x][y])cnt=1;
for(int i=0;i<8;i++){
int xx=x,yy=y;
while(re(xx)&&re(yy)){
xx+=dx[i];
yy+=dy[i];
if(!(re(xx)&&re(yy)))break;
if(g[xx][yy])cnt++;
}
}
return cnt==k;
}
signed main(){
for(int i=1;i<=k;i++){
int a=read(),b=read();
g[a][b]=1;
}
k=0;
for(int i=1;i<=100;i++)
for(int j=1;j<=100;j++)
if(g[i][j])k++;
for(int i=1;i<=100;i++){
for(int j=1;j<=100;j++)
if(check(i,j))
ans++;
write(ans);
return 0;
}