#include<iostream>
#include<cmath>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define MAX 40
using namespace std;

typedef long long ll;

ll coef[MAX];

int main()
{
  coef[0] = 0;
  coef[1] = 1;
  coef[2] = 4;
  REP(i,3,40)coef[i] = coef[i-1]*3+1;

  int n;
  while(cin >> n)
    {
      ll total = 0;
      ll ans = n;
      rep(i,(int)floor(n/2))
	{
	  total += 2*coef[i];
	}
      total *= 2;
      if(n%2 != 0)total += 2*coef[(int)ceil(n/2)];

      cout << ans + total << endl;
    }
  return 0;
}