#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  map<char, long long> mp;
  char s[200005];
  scanf("%I64d", &n);
  scanf("%s", &s);
  long long ans = 0;
  long long len = strlen(s);
  for (long long i = 0; i < len; i++) {
    if (i % 2 == 0)
      mp[s[i]]++;
    else {
      if (mp[s[i] + 32] >= 1) {
        mp[s[i] + 32]--;
        ans++;
      }
    }
  }
  printf("%I64d\n", (n - ans - 1));
  return 0;
}
