#include<iostream> using namespace std; int main(){ int m,s=0; cin>>m; while(m>1){ if(m%2==0){ m=m/2;} else{ m=m*3+1;} } cout<<m<<endl; return 0; }