//cogs 746.[网络流24题] 骑士共存
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#define inf 1e9+7
#define p(i,j) (i-1)*n+j
#define fo(i,j,k) for(i=j;i<=k;i++)
using namespace std;
queue <int> q;
const int mxn=100005;
bool b[205][205];
int n,m,cnt,ans,s,t,tot;
int head[mxn],dis[mxn];
int dx[8]={-2,-2,-1,-1,1,1,2,2},dy[8]={-1,1,-2,2,2,-2,1,-1};
struct node {int to,next,flow;} f[mxn<<2];
inline void add(int u,int v,int flow)
{
f[++cnt].to=v,f[cnt].next=head[u],f[cnt].flow=flow,head[u]=cnt;
f[++cnt].to=u,f[cnt].next=head[v],f[cnt].flow=0,head[v]=cnt;
}
inline bool bfs()
{
int i,j,u,v,flow;
memset(dis,-1,sizeof dis);
q.push(s);
dis[s]=0;
while(!q.empty())
{
u=q.front();
q.pop();
for(i=head[u];i;i=f[i].next)
{
v=f[i].to,flow=f[i].flow;
if(dis[v]==-1 && flow>0)
dis[v]=dis[u]+1,q.push(v);
}
}
if(dis[t]>0) return 1;
return 0;
}
inline int find(int u,int low)
{
int v,i,j,a=0,sum=0,flow;
if(u==t) return low;
for(i=head[u];i;i=f[i].next)
{
v=f[i].to,flow=f[i].flow;
if(flow>0&& dis[v]==dis[u]+1 && (a=find(v,min(low-sum,flow))))
{
f[i].flow-=a;
if(i&1) f[i+1].flow+=a;
else f[i-1].flow+=a;
sum+=a;
}
}
if(!sum) dis[u]=-1;
return sum;
}
int main()
{
freopen("knight.in","r",stdin);
freopen("knight.out","w",stdout);
int i,j,k,u,v,w,d;
scanf("%d%d",&n,&m);
s=0,t=n*n+1,ans=n*n-m;
fo(i,1,m) scanf("%d%d",&u,&v),b[u][v]=1;
fo(i,1,n)
fo(j,1,n) if(!b[i][j])
if(i+j&1) add(s,p(i,j),1);
else add(p(i,j),t,1);
fo(i,1,n)
fo(j,1,n) if(!b[i][j] && i+j&1)
{
int tmp=p(i,j);
fo(k,0,7)
{
int x=i+dx[k],y=j+dy[k];
if(x>=1 && y>=1 && x<=n && y<=n && !b[x][y])
add(tmp,p(x,y),1);
}
}
while(bfs()) ans-=find(s,inf);
printf("%d\n",ans);
return 0;
}
/*
3 2
1 1
3 3
*/