#include <bits/stdc++.h>
using namespace std;
char s[300];
int n, t, len, num, in;
int main() {
  scanf("%d%s", &n, s + 1);
  while (t < n) {
    if (s[t] == '(')
      in = 1;
    else if (s[t] == ')')
      in = 0;
    int i = t + 1;
    while (i <= n && s[i] != '(' && s[i] != ')' && s[i] != '_') i++;
    if (i > t + 1) {
      if (!in)
        len = max(len, i - t - 1);
      else
        num++;
    }
    t = i;
  }
  printf("%d %d\n", len, num);
  return 0;
}
