#include <bits/stdc++.h>
using namespace std;
string s;
int n;
bool cmp(char a, char b) { return a > b; }
void solve() {
  cin >> n;
  cin >> s;
  int fw[n], bw[n];
  map<int, bool> vis;
  for (int i = 0; i < n; i++) {
    fw[i] = 1;
    bw[i] = 1;
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int ind = -1;
    for (int j = 0; j < n; j++) {
      if (!vis[j] && j - bw[j] >= 0 && s[j] == s[j - bw[j]] + 1) {
        ind = j;
        break;
      }
      if (!vis[j] && j + fw[j] < n && s[j] == s[j + fw[j]] + 1) {
        ind = j;
        break;
      }
    }
    if (ind == -1) break;
    for (int j = 0; j < n; j++) {
      if (!vis[j] && s[j] > s[ind] &&
          ((j - bw[j] >= 0 && s[j] == s[j - bw[j]] + 1) ||
           (j + fw[j] < n && s[j] == s[j + fw[j]] + 1))) {
        ind = j;
      }
    }
    vis[ind] = true;
    fw[ind - bw[ind]] += fw[ind];
    bw[ind + fw[ind]] += bw[ind];
    cnt++;
  }
  cout << cnt << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n\n";
}
