#include <iostream>
using namespace std;

int f(int x){
    if(x == 1) return 0;
    else if(x <= 3) return 1;
    else return f(x - 3) + 2 * f(x - 2) + f(x - 1);
}

int main() {
    int a;cin>>a;
    cout<<f(a);
}
// 64 位输出请用 printf("%lld")