solve _ [] = 1
solve [] _ = 0
solve (x:xs) (y:ys)
  | x == y = solve xs ys
  | x /= y = solve xs (y:ys)

main = do
  n <- readLn :: IO Int
  xs <- getLine 
  print $ sum [solve xs [i,j,k] | i <- ['0'..'9'], j <- ['0'..'9'], k <- ['0'..'9']]
  
  
