#include <iostream>
#include <cmath>
using namespace std;
int main() {
  long long n;
  while(cin >> n) {
    if (n%2)
      cout << 2*(long long)pow(3,(n+1)/2)/3-1 << endl;
    else
      cout << (long long)pow(3,n/2)-1 << endl;
  }
}