#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
int k,T,c,f,n,m,p;
long long ans1,ans2,mod=998244353;
char a[3005][3005];
int b[3005][3005];

int main()
{
    freopen("barrack.in","r",stdin);
    freopen("barrack.out","w",stdout);
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>k>>p;
        if(b[1][0]==k||b[1][0]==p||b[1][1]==k||b[1][1]==p)
            c=1;
        b[1][0]=k;
        b[1][1]=p;
        a[p][k]=a[k][p]=1;
    }

    if(m==0)cout<<n;
    if(m==1)cout<<2*n+1;
    if(m==2&&c==0)cout<<4*n+2;
    if(m==2&&c==1)cout<<4*n+3;
    return 0;
}
