with text_io;
procedure The_Towers is

type Spindle_Type is (A, B, C);

R_Count: natural:= 0; -- Count number of recursive calls

procedure Hanoi (n: positive; From_s, Help_S, To_S: Spindle_Type) is
   begin -- Hanoi
      R_Count:= R_Count + 1;
      if n = 1 then
          Text_io.Put ("Move disk from " & Spindle_Type'image(From_S)
                       & " to " & Spindle_Type'image(To_S));
          Text_io.New_Line;
        else
          Hanoi (n-1, From_S, To_S, Help_S);
          Hanoi (1, From_S, Help_S, To_S);
          Hanoi (n-1, Help_S, From_S, To_S);
      end if;
   end Hanoi;

begin -- The_Towers
Hanoi (4, a, b, c);
text_io.Put (integer'image(R_Count) & " recursive calls"); 
text_io.New_Line;
end The_Towers;