include[HTML_REMOVED]
using namespace std;
int ans,n;
void p( int f, int u, int c, int k)
{
if(f == 10)
{
if(u + c == n || c - u == n) ans++;
return;
}
p(f + 1, f, u + c, f);
if (k != 1) p(f + 1, f, c - u, f);
p(f + 1, u * 10 + f, c, k);
}
int main()
{
cin >> n;
p (2, 1, 0, 1);
cout << ans << endl;
}