def main():

    # 入力

    n = int(eval(input()))

    s = eval(input())



    set1 = set()

    set2 = set()

    set3 = set()

    for x in s:

        for x2 in set2:

            _x2 = x2+x

            if x2+x not in set3:

                set3.add(_x2)

        for x1 in set1:

            _x1 = x1+x

            if x1+x not in set2:

                set2.add(_x1)

        if x not in set1:

            set1.add(x)



    print((len(set3)))





main()

def main():

    # 入力

    n = int(eval(input()))

    s = eval(input())



    set1 = set()

    set2 = set()

    set3 = set()

    for x in s:

        for x2 in set2:

            _x2 = x2+x

            set3.add(_x2)

        for x1 in set1:

            _x1 = x1+x

            set2.add(_x1)

        set1.add(x)



    print((len(set3)))





main()

def main():
    # 入力
    n = int(eval(input()))
    s = eval(input())
    set1 = set()
    set2 = set()
    set3 = set()
    for x in s:
        for x2 in set2:
            _x2 = x2 + x
            if x2 + x not in set3:
                set3.add(_x2)
        for x1 in set1:
            _x1 = x1 + x
            if x1 + x not in set2:
                set2.add(_x1)
        if x not in set1:
            set1.add(x)
    print((len(set3)))


main()

def main():
    # 入力
    n = int(eval(input()))
    s = eval(input())
    set1 = set()
    set2 = set()
    set3 = set()
    for x in s:
        for x2 in set2:
            _x2 = x2 + x
            set3.add(_x2)
        for x1 in set1:
            _x1 = x1 + x
            set2.add(_x1)
        set1.add(x)
    print((len(set3)))


main()

-            if x2 + x not in set3: -                set3.add(_x2) +            set3.add(_x2) -            if x1 + x not in set2: -                set2.add(_x1) -        if x not in set1: -            set1.add(x) +            set2.add(_x1) +        set1.add(x)