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

int N;
string S;

bool ok(string t)
{
	while(t.length()<3) t="0"+t;
	int idx = 0;
	for(int i=0;i<N;++i){
		if(S[i]==t[idx]){
			idx++;
			if(idx == 3) return true;
		}
	}
	return false;
}

void solve()
{
	int ans = 0;
	for(int i=0;i<=999;++i){
		if(ok(to_string(i))) ans++;
	}
	cout << ans << "\n";
}

int main()
{
	cin >> N >> S;
	solve();
	return 0;
}
