#include <bits/stdc++.h>
using namespace std;
int n, ans;
string s;
int key[30] = {0};
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin >> n;
  cin >> s;
  int siz = s.size();
  for (__typeof(siz) i = 0; i < siz; i++) {
    if (i % 2 == 0)
      key[s[i] - 'a']++;
    else {
      if (key[s[i] - 'A'] > 0) {
        key[s[i] - 'A']--;
      } else
        ans++;
    }
  }
  cout << ans;
  return 0;
}
