Option Strict On
Imports System.Collections.Generic
Module problemD

    Sub Main()
        Dim n As Integer = Integer.Parse(Console.ReadLine) - 1
        Dim s() As Char = Console.ReadLine.ToCharArray()
        Dim h As New HashSet(Of String)
        Dim ih, jh As New Dictionary(Of String, HashSet(Of String))
        Dim wi, wj, wk As String
        Dim i, j, k As Integer

        For i = 0 To n - 2
            wi = New String(New Char() {s(i)})
            If Not ih.ContainsKey(wi) Then ih.Add(wi, New HashSet(Of String))
            If ih(wi).Count > 9 Then Continue For

            For j = i + 1 To n - 1
                wj = New String(New Char() {s(i), s(j)})
                If Not jh.ContainsKey(wj) Then jh.Add(wj, New HashSet(Of String))
                If jh(wj).Count > 9 Then Continue For

                For k = j + 1 To n
                    wk = New String(New Char() {s(i), s(j), s(k)})
                    If h.Contains(wk) Then Continue For
                    h.Add(wk)
                    jh(wj).Add(s(k).ToString)
                    If jh(wj).Count > 9 Then
                        ih(wi).Add(s(j).ToString)
                        Exit For
                    End If
                Next
            Next
        Next

        Console.Write(h.Count.ToString)
    End Sub

End Module
