#include <bits/stdc++.h>
using namespace std;
bool isSep(char c) { return c == '_' || c == '(' || c == ')'; }
int main() {
  int n;
  char s[258];
  while (scanf("%d", &n) != EOF) {
    scanf("%s", s);
    int len = 0, maxLen = 0, inPa = 0;
    bool paren = false;
    for (int i = 0; i < n; i++) {
      if (isSep(s[i])) {
        if (len > 0 && paren) {
          inPa++;
        }
        if (maxLen < len && !paren) {
          maxLen = len;
        }
        len = 0;
      } else {
        len++;
      }
      if (s[i] == '(') {
        paren = true;
      } else if (s[i] == ')') {
        paren = false;
      }
      if (i == n - 1) {
        if (maxLen < len) {
          maxLen = len;
        }
      }
    }
    printf("%d %d\n", maxLen, inPa);
  }
  return 0;
}
