function Main(input) {
   	var inputArray = input.split("\n");
	var N=inputArray[0]*1;
	var S=inputArray[1];
	
	var first;
	var second;
	var third;
	
	var j;
	
	var hitotsu;
	var futatsu;
	var mittsu;
	var kazoeru=0;
	
	var Idx;
	
	for(var i=0;i<1000;i++){
		first=parseInt(i/100);
		second=parseInt((i-first*100)/10);
		third=i-first*100-second*10;
		
		hitotsu=0;
		futatsu=0;
		mittsu=0;
		
		
		
		for(j=0;j<N;j++){
			Idx=1;
			if(hitotsu==0){
				if(S.charAt(j)*1==first){
					hitotsu=1;
					Idx=0;
					//console.log("hitotsume");
				}
			}
			if(Idx==1&&hitotsu==1&&futatsu==0){
				if(S.charAt(j)*1==second){
					futatsu=1;
					Idx=0;
					//console.log("futatsume");
				}
			}
			if(Idx==1&&hitotsu*futatsu==1){
				if(S.charAt(j)*1==third){
					kazoeru++;
					break;
				}
			}
		}
	}
		
		
	console.log(kazoeru);
	
}
     
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

