{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
import           Data.Maybe
import           Data.Int
import           Data.List
import           Data.Char
  -- import qualified Data.Vector.Unboxing as VU
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import           Data.List (scanl')
import           Data.IORef
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Control.Applicative

readInt = BS.readInt . BS.dropWhile isSpace
getVector f = VU.unfoldr f <$> BS.getLine
getIntVector = getVector readInt
getBSVector = getVector BS.uncons

solve n s = do
  digit1 <- VUM.replicate 1001 False
  forM_ [0..n-3] $ \i -> do
    forM_ [i+1..n-2] $ \j -> do
      forM_ [j+1..n-1] $ \k -> do
        let n1 = s VU.! i
            n2 = s VU.! j
            n3 = s VU.! k
            index = n1*100 + n2*10 + n3
        b <- VUM.read digit1 index
        unless b $ do
          VUM.write digit1 index True
  print . VU.length . VU.filter (\n -> n) =<< VU.freeze digit1

main = do
  n <- readLn :: IO Int
  s <- VU.fromList . map digitToInt <$> getLine
  solve n s

com n 1 = n
com n m = n * (com (n-1) (m-1)) `div` m
