#include <bits/stdc++.h>
using namespace std;
int m[120], n, k = 0;
int main() {
  cin >> n;
  char a, b;
  getchar();
  for (int i = 1; i < n; i++) {
    a = getchar();
    b = getchar();
    m[a - 'a']++;
    if (m[b - 'A'] > 0) {
      m[b - 'A']--;
    } else {
      k++;
    }
  }
  cout << k << endl;
  return 0;
}
