#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const ll MX=1e17;
int m;ll pw;
int cal(ll n,ll m){
	if (n==1) return m==0?10:0;
	if (n==0) return m==0;
	if (m>10*n-9) return 0;
	int d=(10-m%10)%10;
	int v=10-d-(n==pw);
	return v*cal(n/100,abs(m-n*d+d)/10);
}
int main(){
	scanf("%d",&m);int ans=0;
	for (pw=1;pw*10<=m;pw*=10);
	for (;pw<=MX;pw*=10) ans+=cal(pw,m);
	printf("%d",ans);
}