#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  while (cin >> n) {
    string s;
    cin >> s;
    long a[10010] = {0}, x = 0, c = 0, l;
    l = s.size();
    for (int i = 0; i < l; i++) {
      if (i % 2 == 0) {
        a[s[i]]++;
      } else {
        x = s[i] + 32;
        if (a[x] > 0) {
          a[x]--;
        } else
          c++;
      }
    }
    cout << c << "\n";
  }
  return 0;
}
