#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    while (cin >> n) {
        long long ans , a;
        if (n % 2) {
            ans = 1;
            a = 4;
        }
        else {
            ans = 2;
            a = 6;
        }
        for (int i = 0; i < (n - 1) / 2; ++i) {
            ans += a;
            a *= 3;
        }
        cout << ans << "\n";
    }
    return 0;
}