#include<bits/stdc++.h>
using namespace std;
int w;
void f(int n,char q,char c,char z){
	if(n==1)	w++;
	else{
		f(n-1,q,z,c);
		w++;
		f(n-1,c,q,z);
	}
}
int main(){
	int n;
	cin>>n;
	f(n,'A','B','C');
	cout<<w;
}
/**************************************************************
	Problem: 1223
	User: linweilun
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2072 kb
****************************************************************/