local mfl = math.floor
local mma, mab = math.max, math.abs
local d = io.read("*n")
local cnt = 0
-- 2
if d % 9 == 0 then
  local z = mfl(d / 9)
  cnt = cnt + mma(0, 9 - z)
end
-- 3
if d % 99 == 0 then
  local z = mfl(d / 99)
  cnt = cnt + mma(0, 9 - z) * 10
end
-- 4, 5
for y = -9, 9 do
  for z = 0, 8 do
    if z * 999 + y * 90 == d then
      cnt = cnt + (9 - z) * (10 - mab(y))
    end
    if z * 9999 + y * 990 == d then
      cnt = cnt + (9 - z) * (10 - mab(y)) * 10
    end
  end
end
-- 6, 7
for x = -9, 9 do for y = -9, 9 do for z = 0, 8 do
  if z * 99999 + y * 9990 + x * 900 == d then
    cnt = cnt + (9 - z) * (10 - mab(y)) * (10 - mab(x))
  end
  if z * 999999 + y * 99990 + x * 9900 == d then
    cnt = cnt + (9 - z) * (10 - mab(y)) * (10 - mab(x)) * 10
  end
end end end
-- 8, 9
for w = -9, 9 do for x = -9, 9 do for y = -9, 9 do for z = 0, 8 do
  if z * 9999999 + y * 999990 + x * 99900 + w * 9000 == d then
    cnt = cnt + (9 - z) * (10 - mab(y)) * (10 - mab(x)) * (10 - mab(w))
  end
  if z * 99999999 + y * 9999990 + x * 999900 + w * 99000 == d then
    cnt = cnt + (9 - z) * (10 - mab(y)) * (10 - mab(x)) * (10 - mab(w)) * 10
  end
end end end end
-- 10
for v = -9, 9 do w = -9, 9 do for x = -9, 9 do for y = -9, 9 do for z = 0, 8 do
  if z * 999999999 + y * 99999990 + x * 9999900 + w * 999000 + v * 90000 == d then
    cnt = cnt + (9 - z) * (10 - mab(y)) * (10 - mab(x)) * (10 - mab(w)) * (10 - mab(v))
  end
end end end end end

print(cnt)
