#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	int N;
	while(scanf("%d",&N) != EOF){

		if(N%2 == 1){
			printf("%d\n",(int)(2*pow(3,N/2)-1));
		}else{
			printf("%d\n",(int)((2*pow(3,(N-1)/2)-2)/4*6+2));
		}
	}

	return 0;
}