#include<iostream>
#include<cmath>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int main() {
  int n;
  while (cin >> n) {
    if (n % 2) cout << (int)(2 * pow(3, n / 2) - 1) << endl;
    else cout << (int)(pow(3, n / 2) - 1) << endl;
  }
}