#include <bits/stdc++.h>
using namespace std;
string str;
int main() {
  long long t, i, j, n, m, len, lgword, curLen, noWords, bracInLen;
  bool flag = true;
  scanf("%lld", &len);
  cin >> str;
  lgword = curLen = bracInLen = 0;
  noWords = 0;
  for (i = 0; i < len; ++i) {
    if (str[i] == '(' || str[i] == ')' || str[i] == '_') {
      lgword = max(lgword, curLen);
      curLen = 0;
      if (bracInLen > 0) {
        ++noWords;
      }
      bracInLen = 0;
      if (str[i] == '(')
        flag = false;
      else if (str[i] == ')')
        flag = true;
    } else if (flag) {
      ++curLen;
    } else if (!flag) {
      ++bracInLen;
    }
  }
  lgword = max(lgword, curLen);
  printf("%lld %lld\n", lgword, noWords);
  return 0;
}
