#include <bits/stdc++.h>
using namespace std;
bool compare(char x, char y) {
  if (x > y)
    return true;
  else
    return false;
}
int c[30];
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  int res = 0;
  memset(c, sizeof(c), 0);
  for (int i = 0; i < s.size(); i += 2) {
    c[s[i] - 'a']++;
    if (c[s[i + 1] - 'A'] == 0)
      res++;
    else
      c[s[i + 1] - 'A']--;
  }
  cout << res;
  return 0;
}
