import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto s = readln.chomp;
  int[1000] cnt;
  int res;
  foreach (i; 0..s.length) {
    auto d = (s[i] - '0') * 100;
    foreach (j; i+1..s.length) {
      auto e = d + (s[j] - '0') * 10;
      foreach (k; j+1..s.length) {
        auto f = e + s[k] - '0';
        if (!cnt[f]) {
          cnt[f] = true;
          res++;
        }
      }
    }
  }

  res.writeln;
}
