function main(input) {
  var N = input[0]-0;
  var S = input[1];
  var map = {};
  for(var i=0;i<S.length;i++){
    if(!map[S[i]]) map[S[i]] = [];
    map[S[i]].push(i);
  }
  var ans = 0;
  for(var i=0;i<1000;i++){
    var num = ("000"+i).slice(-3);
    var a = map[num[0]];
    var b = map[num[1]];
    var c = map[num[2]];
    var t = find(a, 0);
    if(t==-1) continue;
    t = find(b, t+1);
    if(t==-1) continue;
    t = find(c, t+1);
    if(t==-1) continue;
    ans++;
  }
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').split("\n"))

function find(arr, n, min){
  if(!min)min=0;
  if(!arr) return -1;
  for(var i=min;i<arr.length;i++){
    if(arr[i]>=n) return arr[i];
  }
  return -1;
}
