#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int a[26];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    a[s[2 * i] - 'a']++;
    if (a[s[2 * i + 1] - 'A'] == 0)
      ans++;
    else
      a[s[2 * i + 1] - 'A']--;
  }
  cout << ans << endl;
  return 0;
  ;
  return 0;
}
