#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int N = 1e6+10;
int t,n,m,k,l,r,op,x,y;
int f[N];
bool flag;
//int dp[N][N];
void solve(){
cin>>n;
f[0] = 1,f[1] = 1,f[2]=2;
for(int i = 3;i<=n;i++){
f[i] = f[i-1] + f[i-2] + f[i-3];
}
cout<<f[n];
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}