#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
int ct[27];
int main() {
  int n;
  cout.sync_with_stdio(false);
  cin.sync_with_stdio(false);
  memset(ct, 0, sizeof(ct));
  string s;
  cin >> n >> s;
  int siz = s.size(), ans = 0;
  for (int i = 0, idx; i < siz; i++) {
    if (((int)s[i]) > 96) {
      ct[s[i] - 'a']++;
    } else {
      idx = s[i] - 'A';
      if (ct[idx] > 0)
        ct[idx]--;
      else
        ans++;
    }
  }
  cout << ans;
  return 0;
}
