#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483640;
const int MAXN = 1000005;
char w[MAXN];
int c[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", w);
  int s = 2 * n - 2;
  int res = 0;
  for (int i = 0; i < (s); ++i) {
    if (isupper(w[i])) {
      if (c[toupper(w[i])] > 0) {
        c[toupper(w[i])]--;
      } else {
        res++;
      }
    } else {
      c[toupper(w[i])]++;
    }
  }
  printf("%d\n", res);
  return 0;
}
