#include <bits/stdc++.h>
bool is_char(char ch) {
  if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) return true;
  return false;
}
int main() {
  int n, i, len;
  scanf("%d", &n);
  char *string = (char *)malloc((n + 1) * sizeof(char));
  scanf("%s", string);
  len = strlen(string);
  bool open = false;
  int max = 0;
  for (i = i = 0; i < len; i += 1) {
    if (string[i] == '(') {
      open = true;
      continue;
    }
    if (string[i] == ')') open = false;
    if (open == false) {
      int word_len = 0;
      while (is_char(string[i])) {
        i++;
        word_len++;
      }
      if (string[i] == '(') open = true;
      if (word_len > max) max = word_len;
    }
  }
  int inside = 0;
  open = false;
  for (i = i = 0; i < len; i += 1) {
    if (string[i] == ')') {
      open = false;
      continue;
    }
    if (string[i] == '(')
      open = true;
    else if (open == true) {
      if (string[i] == '_')
        continue;
      else if (string[i] == ')') {
        i--;
        continue;
      } else {
        inside++;
        while (is_char(string[i])) {
          i++;
        }
        if (string[i] == ')') open = false;
      }
    }
  }
  printf("%d %d", max, inside);
  return 0;
}
