#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> cnt(26, 0);
  int ans = 0;
  for (int i = 0; i < (int)s.size(); i++) {
    if ('a' <= s[i] && s[i] <= 'z')
      cnt[s[i] - 'a']++;
    else if (cnt[s[i] - 'A'] == 0)
      ans++;
    else
      cnt[s[i] - 'A']--;
  }
  cout << ans;
  return 0;
}
