OIG VIII - opowiesc

// https://szkopul.edu.pl/problemset/problem/dSJo19HkxZw1_5ThjwFNiKp6/site/?key=statement

#include <iostream>

int m[1000];

int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.tie(0);

    int n;
    std::cin >> n;

    int ans = 0;

    for (int i = 0; i < n; i++) {
        char c;
        std::cin >> c;

        m[(int)c]++;

        int temp_index = c + (c < 'a' ? 1 : -1) * ('a' - 'A');
        int temp = m[temp_index];

        ans += temp > 0;
    }

    std::cout << ans << '\n';

    return 0;
}