#include <bits/stdc++.h>
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
using namespace std;
bool dont[1005];
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  vector<int> v;
  for (register int i = 0; i < str.size(); i++) {
    if (str[i] == '(')
      v.push_back(i);
    else if (str[i] == ')')
      v.push_back(i);
  }
  vector<string> vec;
  for (int i = 0; i < v.size(); i += 2) {
    string s;
    int st = v[i];
    int ed = v[i + 1];
    for (int j = st + 1; j <= ed - 1; j++) s += str[j];
    for (register int j = st + 1; j <= ed - 1; j++) dont[j] = 1;
    vec.push_back(s);
  }
  string now;
  for (register int i = 0; i < str.size(); i++) {
    if (dont[i] == 0) now += str[i];
  }
  int leng = 0;
  int words = 0;
  int L = 0;
  for (int i = 0; i < now.size(); i++) {
    if (now[i] == '(' or now[i] == ')' or now[i] == '_') {
      L = 0;
    } else {
      L++;
      leng = max(L, leng);
    }
  }
  for (register int i = 0; i < vec.size(); i++) {
    int paisi = 0;
    for (register int j = 0; j < vec[i].size(); j++) {
      if (paisi == 0) {
        if (vec[i][j] == '(' or vec[i][j] == ')' or vec[i][j] == '_')
          paisi = 0;
        else {
          words++;
          paisi = 1;
        }
      } else {
        if (vec[i][j] == '(' or vec[i][j] == ')' or vec[i][j] == '_') paisi = 0;
      }
    }
  }
  cout << leng << " " << words << "\n";
}
