#include <bits/stdc++.h>
using namespace std;
map<char, int> mp;
int main() {
  int i, j, k, n, m;
  cin >> n;
  char str[2 * n];
  for (i = 1; i <= 2 * n - 2; i++) {
    cin >> str[i];
  }
  int cnt = 0;
  for (i = 1; i <= 2 * n - 2; i++) {
    if (i % 2 == 1) {
      mp[str[i] - 'a']++;
    }
    if (i % 2 == 0) {
      char ch = str[i] - 'A';
      if (mp[ch] == 0) {
        cnt++;
      } else
        mp[ch]--;
    }
  }
  cout << cnt << endl;
  return 0;
}
