#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " ; ";
  err(++it, args...);
  cout << endl;
}
long long cnt;
string s;
bool solve(char c) {
  bool paisi = false;
  char keep = c;
  keep--;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == c) {
      bool cool = false;
      if (i + 1 < s.size()) {
        if (s[i + 1] == keep) {
          paisi = true;
          s[i] = 'A';
          cool = true;
        }
      }
      if (i - 1 >= 0) {
        if (s[i - 1] == keep) {
          paisi = true;
          s[i] = 'A';
          cool = true;
        }
      }
      if (cool) cnt++;
    }
  }
  if (paisi)
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  cin >> s;
  char c = 'z';
  while (1) {
    while (solve(c)) {
      string temp = "";
      for (int i = 0; i < s.size(); i++) {
        if (s[i] >= 'a' && s[i] <= 'z') temp += s[i];
      }
      s = temp;
    }
    c--;
    if (c == 'a') break;
  }
  cout << cnt << endl;
  return 0;
}
