program abcde;
var
  a,b,c,d,e : integer;
  db : integer;
begin
  db:=0;
  for a:=1 to 9 do
   for b:=1 to 9 do
    for c:=1 to 9 do
     for d:=0 to 9 do
      for e:=0 to 9 do
        if ((a<>b) and (a<>c) and (a<>d) and (a<>e) and (b<>c) and (b<>d) and (b<>e) and (c<>d) and (c<>e) and (d<>e))
          then if (1000*a+100*b+10*d+e + 100*c+10*d+a = 1000*b+100*a+10*e+c)
            then begin
              inc(db);
              writeln(1000*a+100*b+10*d+e,' + ',100*c+10*d+a,' = ',100*b+100*a+10*e+c);
            end;
  writeln(db);
end.
