//Bai 16
#include<bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long
#define se second
#define fi first
#define be begin()
#define en end()
#define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int n;
ll solve(int n)
{
if(n == 0) return 1;
if(n == 1) return 2;
return 3*solve(n-1) - 2*solve(n-2);
}
void Run()
{
cin >> n;
cout << solve(n);
}
int main()
{
Faster;
Run();
return 0;
}
Ly9CYWkgMTYKCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZWwgIlxuIgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lIHVsbCB1bnNpZ25lZCBsb25nIGxvbmcKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBmaSBmaXJzdAojZGVmaW5lIGJlIGJlZ2luKCkKI2RlZmluZSBlbiBlbmQoKQojZGVmaW5lIEZhc3RlciBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsKaW50IG47CmxsIHNvbHZlKGludCBuKQp7CiAgICBpZihuID09IDApIHJldHVybiAxOwogICAgaWYobiA9PSAxKSByZXR1cm4gMjsKICAgIHJldHVybiAzKnNvbHZlKG4tMSkgLSAyKnNvbHZlKG4tMik7Cn0Kdm9pZCBSdW4oKQp7CiAgICBjaW4gPj4gbjsKICAgIGNvdXQgPDwgc29sdmUobik7Cn0KaW50IG1haW4oKQp7CiAgICBGYXN0ZXI7CiAgICBSdW4oKTsKICAgIHJldHVybiAwOwp9Cgo=