#include <bits/stdc++.h>
int main() {
  int n;
  char a[200006];
  int sign[130];
  while (~scanf("%d", &n)) {
    getchar();
    memset(a, 0, sizeof(a));
    memset(sign, 0, sizeof(sign));
    int len = n * 2 - 2;
    scanf("%s", a);
    int sum = 0;
    for (int i = 0; i < len; i++) {
      if (a[i] - 32 == a[i + 1]) {
        i++;
      } else if (a[i] - 32 != a[i + 1]) {
        sign[a[i]]++;
        if (sign[a[i + 1] + 32] != 0) {
          sign[a[i + 1] + 32]--;
          i++;
        } else {
          sum++;
          i++;
        }
      }
    }
    printf("%d\n", sum);
  }
  return 0;
}
