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

int main(){
  int n; cin >> n;
  string s; cin >> s;
  int cnt = 0;
  for(int i = 0; i <= 999; i++){
    int c[3] = {i/100, (i%100)/10, i%10};
    int k = 0;
    for(int j = 0; j < n; j++){
      if('0' + c[k] == s.at(j)){
        k++;
      }
      if(k == 3){
        cnt++;
        break;
      }
    }
  }
  cout << cnt << endl;
}