#include <bits/stdc++.h>
using namespace std;
int main() {
  map<long long int, long long int> m;
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  long long int c = 0;
  for (long long int i = 0; i < 2 * n - 2; i++) {
    if (i % 2 == 0)
      m[int(s[i]) - 32]++;
    else {
      if (m[int(s[i])] == 0)
        c++;
      else
        m[int(s[i])]--;
    }
  }
  cout << c << "\n";
}
