#include <bits/stdc++.h>
using namespace std;
map<char, int> m;
int main() {
  int n, cnt = 0;
  char ch;
  cin >> n;
  for (int i = 0; i < (n - 1) * 2; i++) {
    cin >> ch;
    if (ch >= 'a' && ch <= 'z') {
      m[ch]++;
    } else {
      if (m[tolower(ch)] != 0) {
        m[tolower(ch)]--;
      } else
        cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
