Program Khoang_cach;
const fi='BAI1.IN5';
      fo='BAI1.OU5';
Var m,n,s: longint;
     f: text;
Begin
  Assign(f,fi); reset(f);
  Readln(f,m,n);
  if m< n then
     begin s:=m; m:=n; n:=s; End;
     s:=0;
     While m<> 0 do
     Begin
      s:=s + abs ( m mod 10- n mod 10);
      m:=m div 10;
      n:=n div 10;
     end;
  assign(f,fo); rewrite(f);
  writeln(f, s);
  Close(f)

end.
