import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
import std.regex;

void main() {
  auto size = readln.chomp.to!int;
  auto lucky = cast(char[])readln.chomp;

  bool[int] exists;

  void solve() {
    bool[int] used;
    foreach(x; 0..size-2) {
      foreach(y; x+1..size-1) {
        auto index = 100 + 10*lucky[x] + lucky[y];
        if (index in used) continue;

        foreach(i; 0..10) {
          if (lucky[y+1..size].canFind('0'+i)) exists[1000 + lucky[x]*100 + lucky[y]*10 + i] = true;
        }

        if (used.length == 100) return;
      }
    }
  }

  solve();
  writeln(exists.length);
}
