#include <bits/stdc++.h>
long long int l[256];
int main() {
  long long int a, b, i, j, count = 0, n, l1;
  char str[1000001];
  scanf("%lld", &n);
  scanf("%s", str);
  l1 = strlen(str);
  count = 0;
  for (i = 0; i < l1 - 1; i += 2) {
    l[(int)str[i]]++;
    if (l[(int)str[i + 1] + 32] > 0) {
      l[(int)str[i + 1] + 32]--;
    } else
      count++;
  }
  printf("%lld\n", count);
  return 0;
}
