#include <bits/stdc++.h>
using namespace std;
long long has[27];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  long long n, ans(0);
  cin >> n >> s;
  for (long long i = 0; i < s.length(); i += 2) {
    if (i % 2 == 0) {
      s[i] = toupper(s[i]);
      has[s[i] - 'A']++;
    }
    if (has[s[i + 1] - 'A'] == 0)
      ans++;
    else
      has[s[i + 1] - 'A']--;
  }
  cout << ans;
  return 0;
}
