#include <bits/stdc++.h>
using namespace std;
int dx4[] = {0, 0, 1, -1}, dy4[] = {1, -1, 0, 0};
int dx8[] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int bs(int key, int a[], int len) {
  if (key >= a[len]) return len + 1;
  int l = 0, r = len;
  while (l <= r) {
    int m = (l + r) / 2;
    if (a[m] > key)
      r = m - 1;
    else if (a[m] < key)
      l = m + 1;
    else
      return m;
  }
  return l;
}
struct node {
  int a, b;
  int cnt;
  char res[40];
};
bool cmp(node x, node y) { return x.a < y.a; }
int dp[1005][1005];
vector<char> vc[1005];
bool v[30];
void dfs(char c) {
  if (c == 'm') return;
  for (int i = 0; i < vc[c - 'a'].size(); i++)
    if (!v[vc[c - 'a'][i] - 'a']) {
      char ch = vc[c - 'a'][i];
      v[ch - 'a'] = 1;
      dfs(ch);
    }
}
int sx, sy, ex, ey;
int main() {
  int n, a[300], res = 0;
  char b[400100];
  memset(a, 0, sizeof(a));
  scanf("%d", &n);
  scanf("%s", b);
  for (int i = 0; i < 2 * n - 2; i++) {
    if (b[i] >= 'A' && b[i] <= 'Z') {
      if (a[b[i] - 'A' + 'a'])
        a[b[i] - 'A' + 'a']--;
      else
        res++;
    } else
      a[b[i]]++;
  }
  printf("%d\n", res);
  return 0;
}
