#include <bits/stdc++.h>
int main() {
  int len;
  char s[1111];
  scanf("%d%s", &len, s);
  int res1 = 0, res2 = 0;
  bool tag = false;
  int tmp = 0;
  for (int i = 0; i < len; ++i) {
    if (s[i] == '(') {
      tag = true;
      tmp = 0;
    } else if (s[i] == ')') {
      if (tmp > 0) {
        ++res2;
      }
      tag = false;
      tmp = 0;
    } else if (s[i] == '_') {
      if (tag == true && tmp > 0) {
        ++res2;
      }
      tmp = 0;
    } else {
      ++tmp;
      if (tag == false) {
        res1 = std::max(res1, tmp);
      }
    }
  }
  printf("%d %d\n", res1, res2);
}
