#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, x = 0, y[100] = {0};
  string n;
  cin >> a >> n;
  for (int i = 0; i < n.length(); i += 2) {
    y[n[i] - 96] += 1;
    if (y[n[i + 1] - 64] == 0)
      x++;
    else
      y[n[i + 1] - 64] -= 1;
  }
  cout << x;
  return 0;
}
