#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int cnt[26];
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int len = s.length(), ans = 0, i = 0;
  while (i < len) {
    if (s[i] - s[i + 1] != 'a' - 'A') {
      if (cnt[s[i + 1] - 'A'] > 0) {
        cnt[s[i + 1] - 'A']--;
      } else {
        ans++;
      }
      cnt[s[i] - 'a']++;
    }
    i += 2;
  }
  cout << ans << endl;
  return 0;
}
