#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[26], ctr = 0, i;
  memset(a, 0, sizeof(a));
  scanf("%d", &n);
  char ch[2 * n + 1];
  scanf("%s", ch);
  for (i = 0; i < 2 * n - 3; i += 2) {
    a[ch[i] - 97]++;
    if (a[ch[i + 1] - 65] == 0)
      ctr++;
    else
      a[ch[i + 1] - 65]--;
  }
  printf("%d", ctr);
  return 0;
}
