import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe

readInt = fst . fromJust . BS.readInt
readString = map BS.unpack . BS.words

getInt = readInt <$> BS.getLine
getString = readString <$> BS.getLine

quicknub :: Ord a => [a] -> [a]
quicknub xs = qnub compare xs []

qnub :: (a -> a -> Ordering) -> [a] -> [a] -> [a]
qnub _   []     r = r
qnub _   [x]    r = x:r
qnub cmp (x:xs) r = qpart cmp x xs [] [] r

qpart :: (a -> a -> Ordering) -> a -> [a] -> [a] -> [a] -> [a] -> [a]
qpart cmp x [] rlt rge r =
    qnub cmp rlt (x:qnub cmp rge r)
qpart cmp x (y:ys) rlt rge r =
    case cmp x y of
        LT -> qpart cmp x ys rlt (y:rge) r
        EQ -> qpart cmp x ys rlt rge r
        GT -> qpart cmp x ys (y:rlt) rge r

comb :: Int -> [a] -> [[a]]
comb _ [] = []
comb 1 xs = [[x] | x <- xs]
comb n (x : xs) =
  [x : y | y <- comb (n -1) xs]
    ++ comb n xs

main = do
  n <- getInt
  [s] <- getString
  let xss = comb 3 s
  print $ length (quicknub xss)
