#include <bits/stdc++.h>
using namespace std;
long long int n, h = 0, l = 0;
int a[1000000] = {0};
int b[1000000] = {0};
string s;
int main() {
  cin >> n;
  cin >> s;
  long long int ans = 0;
  for (int i = 0; i < s.length(); i++) {
    if (i % 2 == 0)
      a[s[i] - 'a']++;
    else {
      if (a[s[i] - 'A'] <= 0) {
        ans++;
      } else
        a[s[i] - 'A']--;
    }
  }
  cout << ans;
  return 0;
}
