#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = 20;
int path[N];
int n, ans;
int d[N] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
void dfs(int u, int cost)
{
if (cost > n) return ;
if (cost == n && u == 4)
{
if (path[1] + path[2] == path[3])
ans ++;
return ;
}
for (int i=0; i <= 1000; i ++)
{
path[u] = i;
int sum=0, t = i;
if (!t) sum += d[t];
while (t)
{
sum += d[t%10];
t /= 10;
}
dfs(u+1, cost + sum);
path[u] = 0;
}
}
int main()
{
cin >> n;
n -= 4;
dfs(1, 0);
cout << ans << endl;
return 0;
}