#include <bits/stdc++.h>
using namespace std;
int N;
string S;
int main() {
	cin >> N >> S;
	int r = 0;
	for (int i = 0; i < 1000; ++ i) {
		int n = i;
		int x = 0;
		for (int j = 0; j < N; ++ j) {
			if (S[j] == (n%10) + '0') {
				if (++ x == 3) {
					++ r;
					break;
				}
				n /= 10;
			}
		}
	}
	cout << r << endl;
}
