#include <bits/stdc++.h>
using namespace std;
int keys[28];
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int purchase = 0;
  for (int i = 0; i < 2 * n - 2; i += 2) {
    keys[s[i] - 'a']++;
    int ki = s[i + 1] - 'A';
    if (keys[ki] > 0) {
      keys[ki]--;
    } else {
      purchase++;
    }
  }
  cout << purchase << endl;
}
