import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias t = Tuple!(string, "name", long, "y");

void main()
{
    auto n = lread();
    auto s = sread();
    auto first = new long[](10);
    auto second = new long[](100);
    auto third = new long[](1_000);
    foreach (i; iota(n))
    {
        long idx1 = s[i] - '0';
        if (first[idx1])
            continue;

        foreach (j; iota(i + 1, n))
        {
            long idx2 = idx1 * 10 + s[j] - '0';
            if (second[idx2])
                continue;

            foreach (k; iota(j + 1, n))
            {
                long idx3 = idx2 * 10 + s[k] - '0';
                if (third[idx3])
                    continue;

                third[idx3] = 1;
            }
            second[idx2] = 1;
        }
        first[idx1] = 1;
    }
    third.sum.writeln();
}

auto getdisit(T)(T n)
{
    T i = 0;
    while (abs(n) >= 1)
    {
        n /= 10;
        i++;
    }
    return i;
}

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}
