import Data.Bits
import Data.List
import Control.Monad
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
import Control.Monad.ST
import Data.Maybe (fromMaybe)
import qualified Data.ByteString.Lazy.Char8 as B
import Debug.Trace

divisor :: Int -> [Int]
divisor n = sub 1
  where
    sub i | i > (floor (sqrt $ fromIntegral n)) = []
          | n `mod` i == 0 = if i == (n `div` i) then i : (sub (i+1)) else i : (n `div` i) : (sub (i+1))
          | otherwise = sub (i+1)

main :: IO ()
main = do
  n <- readLn :: IO Int
  as' <- replicateM n $ readLn :: IO [Int]
  let as = V.fromList as'
  ans <- fmap sum $ forM [1..n] $ \i -> do
    fmap sum $ forM [i+1..n] $ \j -> do
      if (as V.! (i-1)) >= (as V.! (j-1)) then return 1 else 0
  print ans
