#include <bits/stdc++.h>
using namespace std;
int a[26];
int main() {
  int n;
  cin >> n;
  string s;
  char ch;
  long long d = 0;
  cin >> s;
  for (long long i = 0; i < s.size(); i += 2) {
    ch = toupper(s[i]);
    a[ch - 'A']++;
    if (a[s[i + 1] - 'A'] == 0) {
      d++;
    } else {
      a[s[i + 1] - 'A']--;
    }
  }
  cout << d << endl;
}
