#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  char tar = 'a';
  int curr = n;
  int ans = 0;
  int m = n;
  for (int i = 0; i < n; i++) {
    if (i == curr) {
      tar++;
      curr += m / 2;
    }
    if (tar != s[i]) {
      ans++;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
