#include <bits/stdc++.h>
int n;
char ch[100010 * 2];
int key[30];
int main(void) {
  int i, door, cnt = 0;
  scanf("%d", &n);
  scanf("%s", &ch[1]);
  for (i = 1; i <= (n - 1) * 2; i += 2) {
    key[ch[i] - 'a' + 1]++;
    door = ch[i + 1] - 'A' + 1;
    if (key[door] >= 1)
      key[door]--;
    else
      cnt++;
  }
  printf("%d\n", cnt);
  return false;
}
