#include <iostream>
using namespace std;
long long arr[61] = {0};
long long num_of_ways(int n){
if(arr[n]) {
return arr[n];
}
else {
arr[n] = num_of_ways(n-1) + num_of_ways(n-2) + num_of_ways(n-3);
}
return arr[n];
}
int main() {
int n;
cin >> n;
arr[0] = 1;
arr[1] = 1;
arr[2] = 2;
cout << num_of_ways(n);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKbG9uZyBsb25nIGFycls2MV0gPSB7MH07Cgpsb25nIGxvbmcgbnVtX29mX3dheXMoaW50IG4pewoJaWYoYXJyW25dKSB7CgkJcmV0dXJuIGFycltuXTsKCX0KCWVsc2UgewoJCWFycltuXSA9IG51bV9vZl93YXlzKG4tMSkgKyBudW1fb2Zfd2F5cyhuLTIpICsgbnVtX29mX3dheXMobi0zKTsKCX0KCXJldHVybiBhcnJbbl07Cn0KaW50IG1haW4oKSB7CglpbnQgbjsKCWNpbiA+PiBuOwoJYXJyWzBdID0gMTsKCWFyclsxXSA9IDE7CglhcnJbMl0gPSAyOwoJY291dCA8PCBudW1fb2Zfd2F5cyhuKTsKCXJldHVybiAwOwp9