#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll> g,v;
map<ll,ll> ANS,mp,mp1;
ll ans = 0,d,pw10[20],digit;
ll solve(int n,ll d) {
	if (n == 1)	{
		if (d == 0) return 10;
		return 0;
	}
	if (n == 0) return d == 0;
	ll x = pw10[n-1] - 1;
	for (int i = -9; i <= 9; i++) {
		if ( abs(d - x*i) < pw10[n-1] ) {
			if ((d - x*i)%10 == 0) {
				ll f = 0;
				if (digit == n) f = mp1[i];
				else f = mp[i];
			return solve(n-2,(d - x*i)/10)*f;
		}
		}
	}
	return 0;
}
int main() {
	ll d;
	cin >> d;
	pw10[0] = 1;
	for (int i = 1; i <= 18; i++) 
		pw10[i] = pw10[i-1]*10;
	for (int i = 0; i <= 9; i++)
	for (int j = 0;j  <= 9; j++)
		mp[i-j]++;
	for (int i = 1; i <= 9; i++)
	for (int j = 1; j <= 9; j++) {
		mp1[i-j]++;
	}
	ll ans = 0;
	for (int i = 1; i <= 19; i++) {
		digit = i;
		ans += solve(i,d);
	}
	cout << ans;
}