#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main() {
  int n; 
  string s;
  cin >> n >> s;
  int ns = s.size();
  int cnt = 0;
  rep(i, 1000) {
    vector<int> pin = {i/100, (i/10)%10, i%10};
    int c = 0;
    rep(j, ns) if (s[j] == (pin[c] + '0')) {
      c++; 
      if (c == 3) { cnt++; break; }
    }
  }
  cout << cnt << endl;
  return 0;
}
