#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[123], sum = 0;
  string s;
  cin >> n >> s;
  for (int i = 1; i <= 122; i++) a[i] = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] <= 91) {
      if (a[s[i] + 32] > 0) {
        a[s[i] + 32]--;
      } else
        sum++;
    } else
      a[s[i]]++;
  }
  cout << sum;
}
