#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int ans;
int needs[26], has[26];
int main() {
  cin >> n;
  cin >> s;
  for (int i = 0; i < n - 1; i++) {
    has[s[2 * i] - 'a']++;
    if (has[s[2 * i + 1] - 'A'] != 0) {
      has[s[2 * i + 1] - 'A']--;
    } else {
      ans++;
    }
  }
  cout << ans;
}
