#include<bits/stdc++.h>

#define ll long long
#define reg register
#define rep(i, a, b) for(int i = a; i <= b; ++i)

using namespace std;
int d, N = 17;
ll ans, a, b = 1;
int main() {
    scanf ("%d", &d);
    if (d % 9) {
        puts("0");
        return 0;
    }
    d /= 9;
    rep (i, 1, N) {
        reg ll res = 1, Tmp = d, all = a * 10 + 1, l = b, r = 1;
        rep (j, 0, i / 2) {
            reg ll tmp = Tmp % (r * 10) / r;            
            reg ll x = 10 - abs(tmp);
            if (!j) x--;
            res *= x, Tmp -= all * tmp, all -= l + r, l /= 10, r *= 10;
        }
        b *= 10, a = a * 10 + 1;
        if(!Tmp) ans += res;
    }
    printf ("%lld\n", ans);
    return 0;
}