uses
  SysUtils;
var
  a, b, c, cnt, len : longint;

function good(n : longint) : boolean;
var
  last, t : longint;
begin
  if (length(IntToStr(n)) <> len) then begin
    good := false;
    exit;
  end;
  last := -1;
  while (n <> 0) do begin
    t := n mod 10;
    if (t = last) then begin
      good := false;
      exit;
    end;
    last := t;
    n := n div 10;
  end;
  good := true;
end;

begin
 reset(input, 'aplusb.in');
 rewrite(output, 'aplusb.out');
 read(c);
 len := length(IntToStr(c));
 cnt := 0;
 for a := 1 to c - 1 do begin
   b := c - a;
   if (good(a)) and (good(b)) then begin
     cnt := cnt + 1;
   end;
 end;
 writeln(cnt);
end.