#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[26] = {0}, c = 0;
  string s;
  cin >> n;
  cin >> s;
  for (int i = 0; i < s.size(); i++)
    if (s[i] >= 'a' && s[i] <= 'z')
      a[s[i] - 'a']++;
    else {
      s[i] += 32;
      if (a[s[i] - 'a'] == 0)
        c++;
      else
        a[s[i] - 'a']--;
    }
  cout << c;
}
