#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<char, int>> m;
  for (int i = 'A'; i <= 'Z'; i++) m.push_back(make_pair(i, 0));
  string str;
  cin >> str;
  int ans = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] <= 'Z')
      if (m[(str[i] - 'A')].second > 0)
        m[(str[i] - 'A')].second--;
      else
        ans++;
    else
      m[((str[i] - 'A') - 26) - 6].second++;
  }
  cout << ans << endl;
  return 0;
}
