#include <bits/stdc++.h>
using namespace std;
int n, nr = 0, maxy = 0, len = 0;
char s[1000];
int main() {
  scanf("%d\n", &n);
  gets(s + 1);
  bool cuvant = false;
  int unde = 0, deschise = 0;
  int i = 1;
  while (i <= n) {
    if (s[i] == '(') {
      if (cuvant == true) {
        cuvant = false;
        if (deschise == 0)
          maxy = max(maxy, len);
        else
          ++nr;
        len = 0;
      }
      ++deschise;
    } else if (s[i] == ')') {
      --deschise;
      if (cuvant == true) {
        ++nr;
        cuvant = false;
        len = 0;
      }
    } else if (s[i] == '_') {
      if (cuvant == true) {
        cuvant = false;
        if (deschise == 0)
          maxy = max(maxy, len);
        else
          ++nr;
        len = 0;
      }
    } else if (isalpha(s[i])) {
      cuvant = true;
      while (isalpha(s[i]) && i <= n) ++i, ++len;
      continue;
    }
    ++i;
  }
  if (isalpha(s[n])) {
    if (deschise != 0)
      ++nr;
    else
      maxy = max(maxy, len);
  }
  printf("%d %d\n", maxy, nr);
  return 0;
}
