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