#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, count[30] = {0};
  string s;
  cin >> n;
  cin >> s;
  int i, temp, ans = 0;
  for (i = 0; i < 2 * n - 2; i = i + 1) {
    if (i % 2 == 0) {
      temp = s[i] - 'a';
      count[temp]++;
    } else {
      temp = s[i] - 'A';
      if (count[temp])
        count[temp]--;
      else
        ans++;
    }
  }
  cout << ans;
  return 0;
}
