#include<iostream>
using namespace std;

int main(){
  int N;
  string S;
  cin >> N;
  cin >> S;
  int ans = 0;
  for(int a=0;a<10;a++) for(int b=0;b<10;b++) for(int c=0;c<10;c++){
    int abc[] = {a,b,c};
    int count = 0;
    for(int i=0; i<N; i++){
      int num = S[i] - '0';
      if(num == abc[count]){
        count++;
        if(count == 3){
          ans++;
          break;
        }
      }
    }
  }
  cout << ans;
  return 0;
}