let n = stdin.ReadLine() |> int
let s = stdin.ReadLine()  
 
 // 高速化のため最初のiの取り方を工夫して、ダブった値は避けるようにする
let allTri =
    let rec allTri seti i =
        seq{ if i > n-1 then
                ()
            else 
                let stri = s.Substring(i,1)
                if seti |> Set.contains stri then
                    yield! allTri seti (i+1)
                else
                    let seti = seti |> Set.add (s.Substring(i,1))
                    for j in i+1..n-1 do
                        for k in j+1..n-1 do
                            yield (i,j,k)
                    yield! allTri seti (i+1)}
    allTri Set.empty 0
 
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.fold (fun set x -> Set.add x set ) Set.empty
|> Set.count
|> stdout.WriteLine