#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
long long arr[61];
arr[0] = 1;
arr[1] = 1;
arr[2] = 2;
for(int i = 3; i <= n; i++){
arr[i] = arr[i-1] + arr[i-2] + arr[i-3];
}
cout << arr[n];
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluKCkgewogICBpbnQgbjsKICAgY2luID4+IG47CiAgIGxvbmcgbG9uZyBhcnJbNjFdOwogICBhcnJbMF0gPSAxOwogICBhcnJbMV0gPSAxOwogICBhcnJbMl0gPSAyOwogICBmb3IoaW50IGkgPSAzOyBpIDw9IG47IGkrKyl7CiAgICAgIGFycltpXSA9IGFycltpLTFdICsgYXJyW2ktMl0gKyBhcnJbaS0zXTsKICAgfQogICBjb3V0IDw8IGFycltuXTsKICAgcmV0dXJuIDA7Cn0K