#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
char s[maxn];
int vis[maxn];
int main() {
  int n;
  while (scanf("%d%s", &n, s) != EOF) {
    memset(vis, 0, sizeof(vis));
    int ans = 0;
    for (int i = 0; i < 2 * n - 2; i += 2) {
      int ch = s[i + 1] - 'A' + 'a';
      vis[s[i]]++;
      if (!vis[ch]) {
        ans++;
      } else
        vis[ch]--;
    }
    printf("%d\n", ans);
  }
  return 0;
}
