#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> next(n);
  vector<int> prev(n);
  for (int i = 0; i < n; ++i) {
    next[i] = i + 1;
    prev[i] = i - 1;
  }
  next[n - 1] = -1;
  vector<list<int>> A(26);
  for (int i = 0; i < n; ++i) A[s[i] - 'a'].push_back(i);
  int ans = 0;
  for (char ch = 25; ch > 0; --ch) {
    int n, p, c;
    bool deleted = true;
    while (deleted) {
      deleted = false;
      auto it = A[ch].begin();
      while (it != A[ch].end()) {
        n = next[*it], p = prev[*it], c = *it;
        if (n >= 0 && s[c] == s[n] + 1) {
          ++ans;
          prev[n] = p;
          if (p >= 0) next[p] = n;
          A[ch].erase(it++);
          deleted = true;
        } else if (p >= 0 && s[c] == s[p] + 1) {
          ++ans;
          next[p] = n;
          if (n >= 0) prev[n] = p;
          A[ch].erase(it++);
          deleted = true;
        } else {
          ++it;
        }
      }
    }
  }
  printf("%d\n", ans);
}
