#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>

using namespace std;
typedef long long LL;
const int maxn = 100005;
const int N = 18;

LL pw[maxn],ans,d; 
void solve(int stp,LL num,LL res,bool fir) {
	if (stp<=1) {
		if (stp) res*=10-fir;
		if (!num) ans+=res;
		return ;
	}
	LL mul=pw[stp-1]-1;
	for (int i=fir?0:-9;i<=9;i++) {
		LL _=num-mul*i;
		if (_%10||abs(_)>pw[stp]) continue;
		solve(stp-2,_/10,res*(10-abs(i)-fir),0);
	}
}
int main()
{
	#ifdef Amberframe
		freopen("arc075f.in","r",stdin);
		freopen("arc075f.out","w",stdout);
	#endif
	scanf("%lld",&d);pw[0]=1ll;
	for (int i=1;i<=N;i++) pw[i]=pw[i-1]*10;
	for (int i=1;i<=N;i++) solve(i,d,1,1);
	printf("%lld",ans);
	return 0;
}