      PROGRAM BUBBLE
      PARAMETER (LIM=50)
      INTEGER ITEM(LIM), I, N, J, PAIRS, LAST, TEMP
      N = 20
      OPEN(1,FILE='oldlst.dat',STATUS='OLD')
      DO 10 I = 1,N
        READ(1,*) ITEM(I)
   10 CONTINUE
      PAIRS = N-1
   20 IF (PAIRS .GT. 0) THEN
         LAST = 1  
         DO 30 I = 1, PAIRS
           IF (ITEM(I) .GT. ITEM(I+1)) THEN
             TEMP = ITEM(I)
             ITEM(I) = ITEM(I+1)
             ITEM(I+1) = TEMP
             LAST = I          
           ENDIF
   30    CONTINUE
         PAIRS = LAST - 1
         GOTO 20
      ENDIF
      WRITE(*,*) (ITEM(I),I=1,N)
      STOP
      END
