#include <bits/stdc++.h>
using namespace std;
int p = 31, m = 10e9 + 7;
int sma[26];
int main() {
  int n, ans = 0;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < 2 * n - 2; i++) {
    if (s[i] >= 97)
      sma[s[i] - 97]++;
    else {
      if (sma[s[i] - 65])
        sma[s[i] - 65]--;
      else
        ans++;
    }
  }
  cout << ans;
  return 0;
}
