main = do
    n <- readLn :: IO Int
    a <- r
    b <- r
    c <- r
    print (length (filter comp [(x,y,z) | x <- a, y <- b, z <- c]))

r = (map (read :: String -> Int).words) <$> getLine

comp (a,b,c) = (a < b) && (b < c)