n=int(eval(input()))

s=tuple(eval(input()))



pin=set()



m=[[] for i in range(10)]

for i in range(n):

    m[int(s[i])].append(i)



    yn=""

for i in range(0,1000):

    yn=""

    stri=format(i,"03d")

    mo=[0]*10

    if len(m[int(stri[0])])>0:

        m01=m[int(stri[0])][0]

    else:

        continue

    if len(m[int(stri[1])])>0:

        for ii in range(len(m[int(stri[1])])):

            if m01<m[int(stri[1])][ii]:

                m02=m[int(stri[1])][ii]

                yn="yes2"

                break

    if yn!="yes2":

        continue



    if len(m[int(stri[2])])>0:

        for ii in range(len(m[int(stri[2])])):

            if m02<m[int(stri[2])][ii]:

                m03=m[int(stri[2])][ii]

                yn="yes3"

                break

    if yn!="yes3":

        continue

    else:

        pin.add(stri)



print((len(pin)))        


n=int(eval(input()))

s=tuple(eval(input()))



m=[[] for i in range(10)]

for i in range(n):

    m[int(s[i])].append(i)



yn=""

icnt=0

for i in range(0,1000):

    yn=""

    stri=format(i,"03d")

    stri=list(map(int,stri))

    if len(m[stri[0]])>0:

        m01=m[stri[0]][0]

    else:

        continue



    if len(m[stri[1]])>0:

        for ii in m[stri[1]]:

            if m01<ii:

                m02=ii

                yn="yes2"

                break

    if yn!="yes2":

        continue



    if len(m[stri[2]])>0:

        for ii in m[stri[2]]:

            if m02<ii:

                yn="yes3"

                break

    if yn!="yes3":

        continue

    else:

        icnt+=1



print(icnt)       

    
n = int(eval(input()))
s = tuple(eval(input()))
pin = set()
m = [[] for i in range(10)]
for i in range(n):
    m[int(s[i])].append(i)
    yn = ""
for i in range(0, 1000):
    yn = ""
    stri = format(i, "03d")
    mo = [0] * 10
    if len(m[int(stri[0])]) > 0:
        m01 = m[int(stri[0])][0]
    else:
        continue
    if len(m[int(stri[1])]) > 0:
        for ii in range(len(m[int(stri[1])])):
            if m01 < m[int(stri[1])][ii]:
                m02 = m[int(stri[1])][ii]
                yn = "yes2"
                break
    if yn != "yes2":
        continue
    if len(m[int(stri[2])]) > 0:
        for ii in range(len(m[int(stri[2])])):
            if m02 < m[int(stri[2])][ii]:
                m03 = m[int(stri[2])][ii]
                yn = "yes3"
                break
    if yn != "yes3":
        continue
    else:
        pin.add(stri)
print((len(pin)))

n = int(eval(input()))
s = tuple(eval(input()))
m = [[] for i in range(10)]
for i in range(n):
    m[int(s[i])].append(i)
yn = ""
icnt = 0
for i in range(0, 1000):
    yn = ""
    stri = format(i, "03d")
    stri = list(map(int, stri))
    if len(m[stri[0]]) > 0:
        m01 = m[stri[0]][0]
    else:
        continue
    if len(m[stri[1]]) > 0:
        for ii in m[stri[1]]:
            if m01 < ii:
                m02 = ii
                yn = "yes2"
                break
    if yn != "yes2":
        continue
    if len(m[stri[2]]) > 0:
        for ii in m[stri[2]]:
            if m02 < ii:
                yn = "yes3"
                break
    if yn != "yes3":
        continue
    else:
        icnt += 1
print(icnt)

-pin = set() -    yn = "" +yn = "" +icnt = 0 -    mo = [0] * 10 -    if len(m[int(stri[0])]) > 0: -        m01 = m[int(stri[0])][0] +    stri = list(map(int, stri)) +    if len(m[stri[0]]) > 0: +        m01 = m[stri[0]][0] -    if len(m[int(stri[1])]) > 0: -        for ii in range(len(m[int(stri[1])])): -            if m01 < m[int(stri[1])][ii]: -                m02 = m[int(stri[1])][ii] +    if len(m[stri[1]]) > 0: +        for ii in m[stri[1]]: +            if m01 < ii: +                m02 = ii -    if len(m[int(stri[2])]) > 0: -        for ii in range(len(m[int(stri[2])])): -            if m02 < m[int(stri[2])][ii]: -                m03 = m[int(stri[2])][ii] +    if len(m[stri[2]]) > 0: +        for ii in m[stri[2]]: +            if m02 < ii: -        pin.add(stri) -print((len(pin))) +        icnt += 1 +print(icnt)