#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  n--;
  int keys[100005] = {0};
  int keysToBuy = 0;
  for (int i = 0; i < n; i++) {
    char k;
    cin >> k;
    keys[k - 'a']++;
    char door;
    cin >> door;
    (door -= 'A') += 'a';
    if (keys[door - 'a'] == 0) {
      keysToBuy++;
    } else
      keys[door - 'a']--;
  }
  cout << keysToBuy << endl;
  return 0;
}
