#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int sum = 0, x;
  int size = 2 * n - 2;
  string s;
  cin >> s;
  int a[200] = {0};
  for (int i = 0; i < size; i++) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      x = int(s[i]);
      a[x]++;
    } else {
      s[i] = tolower(s[i]);
      x = int(s[i]);
      if (a[x])
        a[x]--;
      else
        sum++;
    }
  }
  cout << sum << endl;
  return 0;
}
