import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto N = readln.chomp.to!int;
    auto S = readln.chomp;

    auto dp = new bool[][][][](N+1, 11, 11, 11);

    foreach (i; 0..N) {
        dp[i + 1] = dp[i].dup;
        foreach (j; 0..11) {
            foreach (k; 0..11) {
                if (dp[i][10][j][k]) {
                    dp[i + 1][j][k][S[i] - '0'] = true;
                }
            }
        }
        dp[i + 1][10][10][S[i] - '0'] = true;
    }

    int ans = 0;
    foreach (i; 0..10) foreach (j; 0..10) foreach (k; 0..10) ans += dp[N][i][j][k];
    ans.writeln;
}