process.stdin.resume();
process.stdin.setEncoding('utf8');
// 自分の得意な言語で
// Let's チャレンジ！！

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    
  var sum =0;
  var x= parseInt(lines[0],10);
  var y= lines[1];
  for(var i=0;i<=9;i++){
      var xx = y.indexOf(i);
      if(xx !=-1 && xx<=x-3){
          for(var j=0;j<=9;j++){
              var yy = y.indexOf(j,xx+1);
              if(yy !=-1 && yy<=x-2){
                  for(var k=0;k<=9;k++){
                      var zz = y.indexOf(k,yy+1);
                      if(zz != -1){
                          sum++;
                      }
                  }
              }
          }
      }
  }
 console.log(sum);
 
});