#include <iostream>
#include <cstring>

int pow( int x, int y)
{
	int r = x;

	for(int i = 1; i < y; i++)
		r*=x;

	return r;
}

int main()
{
	int n;
	int dp[31];

	memset( dp, 0, sizeof(dp) );
	dp[1] = 1;
	dp[2] = 2;
	for(int i = 3; i <=30; i++)
	{
		if( i % 2 == 1 )
			dp[i] = dp[i-1] + pow(3, (i-1)/2);
		else if( i % 2 == 0 )
			dp[i] = dp[i-2] + 2*pow(3, (i-2)/2);
	}

	while( ~scanf("%d", &n) )
	{
		std::cout << dp[n] <<std::endl;
	}
	
	return 0;
}