#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  char str[n];
  scanf("%s", str);
  int longestWordOutsideTheParentheses = 0;
  int numberOfWordsInsideTheParentheses = 0;
  int currentWordLength = 0;
  int i = 0;
  int arr[n + 1];
  while (i < n) {
    if (str[i] == '(') {
      i++;
      while (str[i] != ')') {
        if (str[i] >= 65 && str[i] <= 90 || str[i] >= 97 && str[i] <= 122) {
          while (str[i] != '_' || str[i] != ')') {
            if (str[i + 1] == '_' || str[i + 1] == ')') {
              numberOfWordsInsideTheParentheses++;
              break;
            }
            i++;
          }
        }
        i++;
      }
    }
    i++;
  }
  for (i = 0; i < n + 1; i++) arr[i] = 0;
  i = 0;
  while (i < strlen(str)) {
    if (str[i] >= 65 && str[i] <= 90 || str[i] >= 97 && str[i] <= 122) {
      currentWordLength = 0;
      while (str[i] != '_' && str[i] != '(' && str[i] != '\0') {
        currentWordLength++;
        i++;
      }
      arr[i] = currentWordLength;
    }
    if (str[i] == '(') {
      while (str[i] != ')') i++;
    }
    i++;
  }
  longestWordOutsideTheParentheses = arr[0];
  int c;
  for (c = 1; c < strlen(str) + 1; c++) {
    if (arr[c] > longestWordOutsideTheParentheses) {
      longestWordOutsideTheParentheses = arr[c];
    }
  }
  printf("%d %d", longestWordOutsideTheParentheses,
         numberOfWordsInsideTheParentheses);
  return 0;
}
