'use strict';
console.log(function(args){
  const tmp = args.trim().split('\n');
  const N = tmp[0]|0, S = tmp[1];
  let count = 0;
  let usedi = [0,0,0,0,0,0,0,0,0,0];
  for ( let i = 0; i < N-2; i++ ) {
    if ( usedi[S[i]] ) continue;
    usedi[S[i]] = 1;
    let usedj = [0,0,0,0,0,0,0,0,0,0];
    for ( let j = i+1; j < N-1; j++ ) {
      if ( usedj[S[j]] ) continue;
      usedj[S[j]] = 1;
      let usedk = [0,0,0,0,0,0,0,0,0,0];
      for ( let k = j+1; k < N; k++ ) {
        if ( usedk[S[k]] ) continue;
        usedk[S[k]] = 1;
        count++;
      }
    }
  }
  return count.toString();
}(require('fs').readFileSync('/dev/stdin', 'utf8')));
