#include <bits/stdc++.h>
using namespace std;
int f[27];
int n;
char ch;
int main() {
  scanf("%d", &n);
  scanf(" %c ", &ch);
  f[ch - 'a']++;
  int ans = 0;
  for (int i = 1; i <= n - 2; i++) {
    scanf(" %c ", &ch);
    if (f[ch - 'A'] == 0)
      ans++;
    else
      f[ch - 'A']--;
    scanf(" %c ", &ch);
    f[ch - 'a']++;
  }
  scanf(" %c ", &ch);
  if (f[ch - 'A'] == 0) ans++;
  printf("%d\n", ans);
}
