import std.stdio;
import std.conv;
import std.string;
import std.format;
import std.algorithm;
import std.math;

T[][] comb(T)(in T[] arr, in int k) pure nothrow {
    if (k == 0) return [[]];
    typeof(return) result;
    foreach (immutable i, immutable x; arr)
        foreach (suffix; arr[i + 1 .. $].comb(k - 1))
            result ~= x ~ suffix;
    return result;
}

void main()
{
  string lines;
  string buf;

  while (!stdin.eof) {
    buf = stdin.readln();
    lines ~= buf;
  }

  string[] array = splitLines(lines);
    
  int N = array[0].split(" ")[0].to!int;
  string S = array[1];
  
  int[string] ans;
  
  S.split("").comb(3).each!((arr) {
    string key = arr.join(",");
    if (key in ans) { 
    } else {
      ans[key] = 1;
    }
  });
  
  writeln(ans.keys.length); 
}