#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define MN 20
using namespace std;
inline ll in(){
    ll x=0;bool f=0; char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
ll ans,d,pw[MN],dig;
inline ll absol(ll x){return (x>0ll)?x:-x;}
inline ll dfs(ll x,int l,int len){
	if (l>=len-l) {return x?0:((l==len-l)?10:1);}
	ll wy=(10-x%10)%10,rem=x-(wy*pw[len-(l<<1)]-wy);
	return ((l?10:9)-wy)*dfs(absol(rem)/10,l+1,len);
}
int main()
{
	d=in();for (int t=d;t;t/=10) ++dig;pw[0]=1;
	for (int i=1;i<=(dig<<1);++i) pw[i]=pw[i-1]*10ll; 
	for (int i=0;i<=(dig<<1);++i) ans+=dfs(d,0,i);
	printf("%lld",ans);return 0;
}