#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int m = s.length();
  int arr[26];
  for (int i = 0; i < 26; i++) {
    arr[i] = 0;
  }
  int ans = 0;
  for (int i = 0; i < m; i += 2) {
    char c = s[i] - 'a' + 'A';
    if (c != s[i + 1]) {
      arr[c - 'A']++;
      if (arr[s[i + 1] - 'A'] == 0) {
        ans++;
      } else {
        arr[s[i + 1] - 'A']--;
      }
    }
  }
  cout << ans << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  T = 1;
  while (T--) {
    solve();
  }
}
