#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long res = 0;
  map<char, long long> cnt;
  for (long long i = 0; i < s.size(); i += 2) {
    if (toupper(s[i]) == s[i + 1])
      ;
    else if (cnt[s[i + 1]] != 0)
      cnt[s[i + 1]]--, cnt[toupper(s[i])]++;
    else if (toupper(s[i]) != s[i + 1])
      cnt[toupper(s[i])]++, res++;
  }
  cout << res;
  return 0;
}
