#include <bits/stdc++.h>
using namespace std;
const int Max = 1e6 + 5;
const int Mod = 998244353;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<pair<char, int>> v;
  string s;
  cin >> s;
  char pre = s[0];
  v.push_back({pre, 0});
  for (char c : s)
    if (c == pre)
      v.back().second++;
    else
      v.push_back({pre = c, 1});
  int ans = 0;
  for (char c = 'z'; c > 'a'; c--) {
    vector<pair<char, int>> temp;
    for (int i = 0; i < v.size(); i++) {
      bool ok = (i - 1 >= 0 && v[i - 1].first == c - 1);
      ok |= (i + 1 < v.size() && v[i + 1].first == c - 1);
      ok &= (v[i].first == c);
      if (ok)
        ans += v[i].second;
      else if (temp.size() && temp.back().first == v[i].first)
        temp.back().second += v[i].second;
      else
        temp.push_back(v[i]);
    }
    v = temp;
  }
  cout << ans << endl;
  return 0;
}
