#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int res = 0;
  int ip[26];
  for (int(i) = 0; (i) < (26); (i)++) {
    ip[i] = 0;
  }
  for (int(i) = 0; (i) < (2 * n - 2); (i)++) {
    if (i % 2 == 0)
      ip[s[i] - 'a']++;
    else {
      if (!ip[s[i] - 'A']) {
        res++;
      } else
        ip[s[i] - 'A']--;
    }
  }
  cout << res << endl;
  return 0;
}
