#include <bits/stdc++.h>
using namespace std;
string s;
int a[100], i, j, pat = 0, k = 0, l, n;
vector<pair<int, int> > v;
pair<int, int> p;
bool mark[100002] = {0};
int main() {
  cin >> n >> s;
  for (i = 0; i < 2 * n - 2; i++) {
    if (i % 2 == 0) {
      a[s[i] - 'a' + 1]++;
    } else {
      if (a[s[i] - 'A' + 1] > 0) {
        a[s[i] - 'A' + 1]--;
      } else {
        pat++;
      }
    }
  }
  cout << pat << endl;
  return 0;
}
