#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  map<char, int> m;
  int n, cnt = 0;
  cin >> n >> s;
  for (char i = 'a'; i < 'z'; i++) m[i] = 0;
  for (int i = 0; i < s.size(); i++) {
    if (islower(s[i]))
      m[s[i]]++;
    else if (isupper(s[i]) && m[s[i] + 32])
      m[s[i] + 32]--;
    else
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}
