      PROGRAM kagamiMochi
      IMPLICIT NONE
      INTEGER :: N
      INTEGER,ALLOCATABLE :: d(:)
      INTEGER :: a, buffer(2),ans
      LOGICAL :: flag
      
      READ*,N
      ALLOCATE( d(N) )
      DO a = 1,N
        READ*,d(a)
      END DO
      
      DO while(.TRUE.)
      flag = .TRUE.
        DO a = 1,N-1
          IF( d(a)<d(a+1) )THEN
            buffer(1:2) = d(a:a+1)
            d(a) = buffer(2); d(a+1) = buffer(1)
            flag = .FALSE.
          END IF
          
        END DO
        
        IF(flag) EXIT
      END DO
      
      
      ans = 1
      DO a = 1,N-1
        IF( d(a)>d(a+1) )THEN
          ans = ans + 1
        END IF
      END DO
      
      
      print'(I0)',ans
      
      
      
      END PROGRAM