#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  string str = "abcdefghijklmnopqrstuvwxyz";
  int ans = 0;
  for (int i = 24; i >= 0; i--) {
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == str[i]) {
        int cnt = 0;
        while ((j + cnt + 1) < s.size() && str[i + 1] == s[j + cnt + 1]) {
          cnt++;
        }
        ans += (cnt);
        s.erase(j + 1, cnt);
      } else if (s[j] == str[i + 1]) {
        int cnt = 1;
        while ((j + cnt) < s.size() && s[j + cnt] == str[i + 1]) {
          cnt++;
        }
        if (s[j + cnt] == str[i]) {
          s.erase(j, cnt);
          ans += (cnt);
          j--;
        } else {
          j += (cnt - 1);
        }
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
