#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() 
{
    int i=0;
    int j=0;
    int n=0;
    cin>>n;
    vector<string> a;
    a.push_back("1");
    a.push_back("1");
    a.push_back("2");
    for(i=3;i<n;i++)
    {
        string b=a[i-1];
        string c=a[i-3];
        string d;
        int count=0;
        int len1=b.size();
        int len2=c.size();
        int len=max(len1,len2);
        if(len1<len)
        {
            reverse(b.begin(),b.end());
            for(j=len1;j<len;j++)
            {
                b+='0';
            }
            reverse(b.begin(),b.end());
        }
        else 
        {
            reverse(c.begin(),c.end());
            for(j=len2;j<len;j++)
            {
                c+='0';
            }
            reverse(c.begin(),c.end());
        }
        for(j=len-1;j>=0;j--)
        {
            int m=b[j]-'0'+c[j]-'0'+count;
            if(m>=10)
            {
                count=1;
            }
            else 
            {
                count=0;
            }
            d+=m%10+'0';
        }
        if(count)
        {
            d+='0'+count;
        }
        reverse(d.begin(),d.end());
        a.push_back(d);
    }
    cout<<a[n-1];
    return 0;
}