#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  while (cin >> n) {
    s = "";
    cin >> s;
    int a[27];
    memset(a, 0, sizeof(a));
    int i, j, cnt = 0;
    for (i = 0; i < 2 * n - 2; i++) {
      if (i % 2 == 0) {
        int c = s[i] - 'a';
        a[c]++;
      } else {
        int c = s[i] - 'A';
        if (a[c] == 0)
          cnt++;
        else
          a[c]--;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
