#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long nRooms;
  cin >> nRooms;
  vector<int> vCollKeys(26, 0);
  string s;
  cin >> s;
  long long res = 0;
  for (long long i = 0; i < s.length(); i += 2) {
    char chKey = s[i];
    char chDoor = s[i + 1];
    vCollKeys[(int)(chKey)-97]++;
    if (vCollKeys[((int)chDoor) - 65] > 0) {
      vCollKeys[((int)chDoor) - 65]--;
    } else {
      res++;
    }
  }
  cout << res << '\n';
  return 0;
}
