#include <bits/stdc++.h>
using namespace std;
int ln;
char s[100005];
char temp[1005];
bool isAl(char x) {
  if (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z') return 1;
  return 0;
}
void solve() {
  int i, lnn, cntTu, tm, maxxln;
  bool isP = false;
  tm = 0;
  cntTu = 0;
  maxxln = 0;
  cin >> s;
  for (i = 0; i <= ln; i++) {
    if (isAl(s[i])) {
      temp[tm++] = s[i];
    } else if (tm > 0) {
      temp[tm] = 0;
      lnn = strlen(temp);
      if (!isP)
        maxxln = max(maxxln, lnn);
      else
        cntTu++;
      tm = 0;
    }
    if (s[i] == '(') {
      isP = true;
    }
    if (s[i] == ')') {
      isP = false;
    }
  }
  cout << maxxln << " " << cntTu << endl;
}
int main() {
  while (cin >> ln) solve();
  return 0;
}
