#include <stdio.h>
int trb(int n){
     if (n==0||n==1){
       return 0;
    }
     if (n==2){
         return 1;
   }

 else return trb(n-1)+trb(n-2)+trb(n-3);
}

int main(void) {
  int n;
 scanf("%d",&n);
 int result =trb(n);
 printf("第%d項の値は%dです。",n,result);
	// your code goes here
	return 0;
}
