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

int main(){
  int n; cin >> n;
  string s; cin >> s;
  set<char> a; set<pair<char,char>> b; set<tuple<char,char,char>> c;
  for (int i = n-1; i >= 0; i--){
    for (auto u : b){
      char x = u.first, y = u.second;
      c.insert(make_tuple(s.at(i), x, y));
    }
    for (char c : a) b.insert(make_pair(s.at(i), c)); 
    a.insert(s.at(i));
  }
  cout << c.size() << endl;
  return 0;
}