#pragma -xO
      subroutine hanoi (n, m, p, q, r)
      implicit integer (a-z)
      integer*8 m
      if (n .eq. 1) then
        m = m + 1
      else
        call hanoi (n - 1, m, p, r, q)
        call hanoi (1, m, p, q, r)
        call hanoi (n - 1, m, q, p, r)
      endif
      end

      program main
      integer*8 m
      do 1 k = 2, 24
      m = 0
      call hanoi (k, m, 1, 2, 3)
    1 write (*, *) k, ' disks require ', m, ' moves'
      end
