#include<bits/stdc++.h>
using namespace std;
struct oe{
int x,cost;
};
//bool s[10001];
int d[]={-1,1,0};
int main(){
int n;
cin>>n;
queue<oe> q;
q.push({1,0});
while(q.size()){
oe tmp=q.front();
q.pop();
tmp.cost++;
for(int i=0;i<3;i++){
tmp.x=tmp.x+(d[i]?d[i]:tmp.x);
if(tmp.x==n){
cout<<tmp.cost;
return 0;
}
//if(!s[tmp.x])
q.push(tmp);
}
}
return 0;
}