#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, rooms = 0;
  char a, b;
  scanf("%d\n", &n);
  int arr[30];
  for (int i = 0; i < 26; i++) arr[i] = 0;
  for (int i = 0; i < 2 * (n - 1); i += 2) {
    scanf("%c%c", &a, &b);
    arr[(int)(a - 'a')]++;
    if (arr[(int)(tolower(b) - 'a')] > 0)
      arr[(int)(tolower(b) - 'a')]--;
    else
      rooms++;
  }
  cout << rooms << endl;
  return 0;
}
