       program reorder
         integer*4 i, n
         character*100 entry
         character*80 fname1, fname2

         write(*,*) 'input axf file: '
         read(*,'(a80)') fname1

         write(*,*) 'output axf file: '
         read(*,'(a80)') fname2

         open(11, file=fname1, status='old')
         open(12, file=fname2, status='new')         

         do i = 1, 2
            read(11,'(a100)') entry
            write(12,'(a100)') entry
         end do

         read(11,'(a100)',iostat=ios) entry
         do while (ios .eq. 0)
            n = n + 1
            write(entry(1:3),'(i3)') n
            write(*,'(a100)') entry
            write(12,'(a100)') entry
            read(11,'(a100)',iostat=ios) entry
         end do          

         write(*,*) 'number of objects = ', n

         close(11)
         close(12)
 
         call exit(0)
       end 
