OIG XII - naw

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

#include <bits/stdc++.h>

using namespace std;

constexpr int sizik = 1000 * 1001;

#define int long long

#define ar std::array
#define pr std::pair
#define vec std::vector

typedef long long ll;
typedef vec<vec<int>> _kra;

void solve() {
    int n;
    std::cin >> n;

    std::string s;
    std::cin >> s;

    int c = 0, ans1 = 0, ans2 = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        if (s[i] == '(')
            c++;
        else
            c--;

        if (c < 0) c++, ans1++;
    }

    if (c > 0) ans2 += c;

    std::cout << ans1 << " " << ans2 << '\n';
}

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

    int t = 1;
    // std::cin >> t;

    for (; t > 0; t--) {
        solve();
    }

    return 0;
}