#include <bits/stdc++.h>
using namespace std;
char s[300];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  int ca = -1, cb = 0;
  int cl = 0, inb = 0;
  for (int i = 0;; i++) {
    if (isalpha(s[i])) {
      cl++;
    } else {
      if (!inb) ca = max(cl, ca);
      if (cl) cb += inb;
      cl = 0;
      if (s[i] == ')')
        inb = 0;
      else if (s[i] == '(')
        inb = 1;
      else if (s[i] == 0)
        break;
    }
  }
  printf("%d %d", ca, cb);
  return 0;
}
