#include <bits/stdc++.h>
int main() {
  int size, i, j;
  int max = 0, Word1 = 0, Words = 0, letter = 0, k;
  scanf("%d", &size);
  char arr[size];
  scanf("%s", arr);
  i = 0;
  if (arr[0] == '(' && arr[size - 1] == ')') {
    max = 0;
  }
  for (i = 0; i < size; i++) {
    if (arr[i] != '(') {
      while (arr[i] != '_' && arr[i] != '(' && arr[i] != '\0') {
        letter++;
        i++;
      }
      if (letter > max) {
        max = letter;
      }
      letter = 0;
    }
    if (arr[i] == '(') {
      i++;
      while (arr[i] != ')') {
        while (arr[i] == '_') {
          i++;
        }
        if (arr[i] != ')') {
          while (arr[i] != '_' && arr[i] != ')') {
            i++;
          }
          Words++;
          while (arr[i] == '_') {
            i++;
          }
        }
      }
    }
  }
  printf("%d %d", max, Words);
  return 0;
}
