#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  scanf("%d", &n);
  char s[200005];
  scanf("%s", s);
  int keys[27];
  memset(keys, 0, sizeof keys);
  int cnt = 0;
  for (int i = 0; i < 2 * n - 2; i++) {
    if (i % 2 == 0) {
      keys[s[i] - 'a']++;
    } else {
      if (keys[s[i] - 'A'] != 0)
        keys[s[i] - 'A']--;
      else
        cnt++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
