#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  cin >> n;
  string str;
  cin >> str;
  long long int demand = 0;
  multiset<char> s;
  for (i = 0; i <= str.length() - 2; i = i + 2) {
    if (str[i] - str[i + 1] == 32) {
    } else {
      if (s.find((str[i + 1] + 32)) != s.end()) {
        multiset<char>::iterator it;
        it = s.find((str[i + 1] + 32));
        s.erase(it);
        s.insert(str[i]);
      } else if (s.find((str[i + 1] + 32)) == s.end()) {
        demand++;
        s.insert(str[i]);
      }
    }
  }
  cout << demand << endl;
  return 0;
}
