#可以从2转移到(2,n-2)n是偶数
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int n=1e6+11;
int a,b[n],c[n];
signed main()
{
cin>>a;
if(a==1)
{
cout<<"0"<<endl;
}
else if(a==2)
{
cout<<"2"<<endl;
}
else if(a==3)
{
cout<<"4"<<endl;
}
else if(a%2==0)
{
cout<<"4"<<endl;
}
else if(a%2==1)
{
cout<<"6"<<endl;
}
}