#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, i, j, k;
  string s;
  {
    cin >> n;
    cin >> s;
    int l = s.length(), h[30] = {0};
    int count = 0;
    for (i = 0; i < l; i++) {
      if (islower(s[i])) {
        h[s[i] - 'a']++;
      } else {
        if (h[s[i] - 'A'] > 0) {
          h[s[i] - 'A']--;
        } else {
          count++;
        }
      }
    }
    cout << count << endl;
  }
}
