let n = stdin.ReadLine() |> int
let s = stdin.ReadLine()  

let allTri =
    seq{ for i in 0..n-1 do
            for j in i+1..n-1 do
                for k in j+1..n-1 -> (i,j,k)}

let take3 (str:string) (a1,a2,a3) =
    str.Substring(a1,1)+str.Substring(a2,1)+str.Substring(a3,1)

allTri 
|> Seq.map (take3 s)
|> Seq.toList
|> List.fold (fun set x -> Set.add x set ) Set.empty
|> Set.count
|> stdout.WriteLine
