#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  while (cin >> n) {
    string s;
    cin >> s;
    int A[100];
    memset(A, 0, sizeof A);
    int res = 0;
    for (long long i = 0; i < s.length(); i += 2) {
      char door = s[i + 1];
      char key = s[i];
      A[int(key) - int('a')]++;
      if (A[int(door) - int('A')] > 0)
        A[int(door) - int('A')]--;
      else
        res++;
    }
    cout << res << endl;
  }
  return 0;
}
