#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  char s[260];
  scanf("%s", s);
  bool flag = 1;
  int ans, maxsans = -1, out = 0;
  for (int i = 0; i < n; i++) {
    ans = 0;
    while (flag and (s[i] >= 'a' and s[i] <= 'z') or
           (s[i] >= 'A' and s[i] <= 'Z')) {
      ans++;
      i++;
    }
    maxsans = max(maxsans, ans);
    if (s[i] == '(') {
      flag = 0;
      i++;
      while (s[i] != ')') {
        if (s[i] == '_' and s[i - 1] != '_' and s[i - 1] != '(') out++;
        i++;
      }
      if (s[i] == ')' and s[i - 1] != '_' and s[i - 1] != '(') out++;
      flag = 1;
    }
  }
  printf("%d %d\n", maxsans, out);
  return 0;
}
