#include <iostream>
#include <cstdio>
using namespace std;
__int64 N;
__int64 hanoi(int n)
{ if (n==1)
return 2;
else{
return (hanoi(n-1) * 3+2);
}
}
int main(){
while(cin>>N){
cout<<hanoi(N)<<endl;
}
return 0;
}
#include <iostream>
#include <cstdio>
using namespace std;
__int64 N;
__int64 hanoi(int n)
{ if (n==1)
return 2;
else{
return (hanoi(n-1) * 3+2);
}
}
int main(){
while(cin>>N){
cout<<hanoi(N)<<endl;
}
return 0;
}