      PROGRAM goToSchool
      IMPLICIT NONE
      INTEGER :: N
      INTEGER,ALLOCATABLE :: A(:),ans(:),iniA(:)
      
      INTEGER :: i, buffer, in ,out
      LOGICAL :: flag
      
      
      READ*,N
      ALLOCATE( A(N),ans(N),iniA(N) )
      READ*,A(:)
      iniA(:) = A(:)
      
      ans = (/ (i, i = 1,N) /)
      
      
!      outer:DO while( .true. )
!      flag = .true.
!        DO i = 1,N-1
!          IF( A(i)>A(i+1) )THEN
!            buffer = A(i+1)
!            A(i+1) = A(i)
!            A(i)   = buffer
!            
!            flag = .false.
!          END IF
!        END DO
!        IF(flag) EXIT outer
!      END DO outer
      CALL bubbleSort( A,N )
      
      
      DO out = 1,N
        DO in = 1,N
          IF( A(out)==iniA(in) )THEN
            ans(out) = in
          END IF
        END DO
      END DO
      
      
      
      
      print*,ans(:)
      
      END PROGRAM
      
      
      SUBROUTINE bubbleSort( a,n )
        IMPLICIT NONE
        INTEGER,INTENT(INOUT) :: a(n)
        
        INTEGER :: i,j, buffer,n
        
        DO j = 1,n-1
          DO i = j+1, n
            IF( a(j)>a(i) )THEN
              buffer = a(i); a(i)=a(j); a(j) = buffer
            END IF
          END DO
        END DO
      
      END SUBROUTINE bubbleSort
      