#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 31 - 1;
const int max9 = 1e9;
const int max6 = 1e6;
const int max3 = 1e3;
const double pi = 4.0 * atan(1.0);
const int mod = 1000000007;
const double E = exp(1.0);
const double EXP = 1e-8;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
char str[200005];
int main() {
  int n;
  int t[26] = {0};
  scanf("%d", &n);
  scanf("%s", str);
  int len = strlen(str);
  int Sum = 0;
  for (int i = 0; i < len; i++) {
    if (isalpha(str[i])) {
      if (str[i] < 'a') {
        if (t[str[i] - 'A']) {
          t[str[i] - 'A']--;
        } else
          Sum++;
      } else
        t[str[i] - 'a']++;
    }
  }
  printf("%d\n", Sum);
  return 0;
}
