#include <bits/stdc++.h>
int main() {
  int n, i, c = 0, np = 0, cmax = 0;
  scanf("%d", &n);
  char A[n];
  scanf("%s", A);
  int C[n];
  for (i = 0; i < n; i++) C[i] = 0;
  for (i = 0; i < n; i++) {
    while (A[i] != '_' && A[i] != '(' && i < n) {
      C[c] += 1;
      i++;
    }
    c++;
    if (A[i] == '(') {
      while (A[i] != ')') {
        i++;
        if (A[i] != '_' && A[i] != ')') {
          np += 1;
          while (A[i] != '_' && A[i] != ')') i++;
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (C[i] > cmax) cmax = C[i];
  }
  printf("%d %d", cmax, np);
  return 0;
}
