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