#include<bits/stdc++.h>

using namespace std;

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count = 0;
  for(int k = 0; k < 1000; k++){
    int key = k;
    int d = 100;
    for(int i = 0; i < N; i++){
      if((int)(S[i] - '0') == key / d){
        key -= (key / d) * d;
        d /= 10;
      }
      if(d == 0){
        count++;
        break;
      }
    }
  }
  
  cout << count << endl;
}