#include <bits/stdc++.h>
using namespace std;
map<char, int> mp;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 0; i < 2 * n - 2; i++) {
    if (i % 2 == 0) {
      mp[s[i]]++;
    } else {
      s[i] = tolower(s[i]);
      if (mp[s[i]] > 0)
        mp[s[i]]--;
      else
        ans++;
    }
  }
  cout << ans;
  return 0;
}
