#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 5;
char s[maxn];
int pre[maxn], nxt[maxn];
bool vis[maxn];
int main() {
  int n;
  scanf("%d %s", &n, s + 1);
  for (int i = 1; i <= n; ++i) {
    pre[i] = i - 1;
    nxt[i] = i + 1;
  }
  int ans = 0;
  while (true) {
    int id = 0;
    for (int i = 1; i <= n; ++i) {
      if (!vis[i] && (s[pre[i]] == s[i] - 1 || s[nxt[i]] == s[i] - 1) &&
          s[i] > s[id]) {
        id = i;
      }
    }
    if (id) {
      ++ans;
      vis[id] = 1;
      nxt[pre[id]] = nxt[id];
      pre[nxt[id]] = pre[id];
    } else
      break;
  }
  printf("%d\n", ans);
  return 0;
}
