#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const long long mod = 1e9 + 7;
const unsigned long long INF = 1e18;
const int N = 2001;
string s;
int res, len, n, cnt1, cnt2;
bool is = false;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '(') {
      is = 1;
      if (cnt1) len = max(len, cnt1);
      cnt1 = 0;
    } else if (s[i] == ')') {
      is = 0;
      if (cnt1) cnt2++;
      cnt1 = 0;
    } else {
      if (is) {
        if (s[i] == '_')
          cnt2 += (bool)cnt1, cnt1 = 0;
        else
          cnt1++;
      } else {
        if (s[i] == '_')
          len = max(len, cnt1), cnt1 = 0;
        else
          cnt1++;
      }
    }
  }
  len = max(len, cnt1);
  cout << len << " " << cnt2;
}
