#include <bits/stdc++.h>
using namespace std;
char s[200001];
long long a[26];
long long cnt = 0;
int main() {
  long long i, j, k, l, m, n, t;
  cin >> t;
  cin >> s;
  l = strlen(s);
  for (i = 0; i < 26; i++) a[i] = 0;
  for (i = 1; i < l; i = i + 2) {
    if ((s[i - 1] - 97) != (s[i] - 65)) {
      if (a[s[i] - 65] > 0) {
        a[s[i] - 65]--;
        a[s[i - 1] - 97]++;
      } else {
        cnt++;
        a[s[i - 1] - 97]++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
