#include<bits/stdc++.h>
using namespace std;
int n;
const int N=1e5+10;
int cnt=0,h[N],que[N];
bool vis[1010][1010];
int fx[]={-1,1,0,0};
int fy[]={0,0,-1,1};
struct node{
int x,y;
}a[100010];
bool in(int x, int y){
return x>=1&&x<=n&&y>=1&&y<=n;
}
void bfs(int i, int j){
int head=1,tail=1;
a[tail].x=i;
a[tail].y=j;
vis[1][1]=1;
while(head<=tail){
head++;
for(int i=0; i<4; i++){
int cx=a[head].x+fx[i];
int cy=a[head].y+fy[i];
if(in(cx,cy)&&vis[cx][cy]==0){
tail++;
vis[cx][cy]=vis[a[head].x][a[head].y]+1;
a[tail].x=cx;
a[tail].y=cy;
}
}
}
}
int main(){
cin>>n;
memset(vis,0,sizeof vis);
bfs(1,1);
printf("%d ",vis[n][n]);
return 0;
}