#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  const int N = 26;
  int mas[26];
  for (int i = 0; i < N; ++i) mas[i] = 0;
  int rez = 0;
  for (int i = 0; i < n * 2 - 2; ++i) {
    char a;
    cin >> a;
    if (isupper(a)) {
      if (mas[tolower(a) - 'a'] > 0)
        mas[tolower(a) - 'a']--;
      else
        rez++;
    } else
      mas[a - 'a']++;
  }
  cout << rez << endl;
  return 0;
}
