#include<bits/stdc++.h>
using namespace std;

int main(void){
	int n;
	string s;
	cin >> n >> s;

	int res = 0;
	for(int i = 0; i < 1000; i++){
		int pos = 0;
		while(pos < n){
			if(s[pos++] - '0' == i / 100) break;
		}
		while(pos < n){
			if(s[pos++] - '0' == (i%100) / 10) break;
		}
		while(pos < n){
			if(s[pos++] - '0' == (i % 10)){
				res++;
				break;
			}
		}
	}

	cout << res << endl;
	return 0;
}