#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int a[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,29,30,31,32,33,34,35,36,37,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,59,61,62,63,64,65,67,70,71,72,73,74,75,76,77,78,79,81,84,87,91,92,93,94,95,97,101,107,110,111,112,113,114,115,116,117,118,119,121,124,127,131,134,137,141,142,143,144,145,147,151,154,157,161,167,170,171,172,173,174,175,176,177,179,181,191,197,211,214,217,241,271,277,311,314,317,341,371,377,411,412,413,414,415,417,421,431,441,447,451,471,474,477,511,514,517,541,571,577,611,617,671,701,710,711,712,713,714,715,716,717,719,721,727,731,737,741,744,747,751,757,761,771,772,773,774,775,777,791,811,911,917,971,1111,1112,1113,1114,1115,1117,1121,1131,1141,1147,1151,1171,1174,1177,1211,1311,1411,1417,1471,1511,1711,1714,1717,1741,1771,1777,2111,3111,4111,4117,4171,4711,5111,7111,7114,7117,7141,7171,7177,7411,7711,7717,7771,11111,11117,11171,11711,17111,71111};
const int b[]={6,2,5,5,4,5,6,3,7,6,8,4,7,7,6,7,8,5,9,8,11,7,10,10,9,10,11,8,11,11,7,10,10,9,10,11,8,11,10,6,9,9,8,9,10,7,11,10,11,7,10,10,9,10,11,8,11,8,11,11,10,11,9,9,5,8,8,7,8,9,6,10,9,9,11,10,8,11,11,10,11,9,10,11,10,6,9,9,8,9,10,7,11,10,9,11,10,9,11,10,8,11,11,10,11,9,9,11,10,10,11,11,7,10,10,9,10,11,8,11,11,10,11,9,11,10,11,10,11,9,11,10,11,10,11,8,11,11,10,11,9,11,11,10,11,11,9,11,10,9,11,10,11,10,11,10,11,11,11,11,7,10,10,9,10,11,8,11,10,11,10,11,9,11,10,10,11,11,8,11,11,10,11,9,11,11,10,11,11,8,11,11,10,11,9,11,11,10,11,11,9,11,10,11,11,10,11,11,11,9,11,10,11,10,11,11,11,10,11,11,11,11,9,11,10,11,10,11,11,10,11,11,10,11,11,11,11,11};
int n,ans=0;
int main(){
scanf("%d",&n);n-=4;
if(n<=9){puts(n==9?"1":"0");return 0;}
for(int i=0;i<238;i++)
for(int j=i;j<238;j++)
for(int k=0;k<238;k++)
if(a[i]+a[j]==a[k]&&b[i]+b[j]+b[k]==n) ans+=(1+(i!=j));
printf("%d
",ans);
return 0;
}