#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
int main() {
  string s;
  int n = 5, counter = 0, prevKeys[200];
  for (int i = 0; i < 200; ++i) {
    prevKeys[i] = 0;
  }
  cin >> n >> s;
  for (int i = 0; i < 2 * n - 2; i += 2) {
    if (tolower(s[i]) != tolower(s[i + 1])) {
      if (prevKeys[tolower(s[i + 1])] > 0) {
        prevKeys[tolower(s[i + 1])]--;
        prevKeys[tolower(s[i])]++;
      } else {
        counter++;
        prevKeys[tolower(s[i])]++;
      }
    }
  }
  cout << counter;
  return 0;
}
