import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.bitmanip;

void main() {
  immutable n = readln.strip.to!int;
  auto s = readln.strip;
  BitArray m1, m2, m3;
  m1.length = 10;
  m2.length = 100;
  m3.length = 1000;
  debug stderr.writeln (s);
  foreach (i; 0 .. n) {
    int x = s[i].to!int - 48;
    foreach (k; m2.bitsSet ()) {
      m3[10 * k + x] = true;
    }
    foreach (k; m1.bitsSet ()) {
      m2[10 * k + x] = true;
    }
    m1[x] = true;
  }
  int c;
  foreach (k; m3.bitsSet()) ++c;
  writeln (c);
}

