//2019/12/1.
//ALL search. O(1000*n).
//Refering to exp.
#include<iostream>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
	int n;
	string s;
	cin>>n>>s;
	
	int cnt=0;
	REP(i,1000){//point.
		int c[]={i/100,(i%100)/10,i%10};
		int p=0;
		REP(i,n){
			if(s[i]-'0'==c[p]) p++;
			if(p==3) break;
		}
		if(p==3) cnt++;
	}
	
	cout<<cnt<<endl;
}
