#include <bits/stdc++.h>
using namespace std;
inline bool equal(double _x, double _y) {
  return _x > _y - 1e-9 && _x < _y + 1e-9;
}
char s[300];
int mx, cnt, sum, ans;
bool OK(char c) {
  if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') return 1;
  return 0;
}
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  for (int l = 0, r = 0; l < n; l = r) {
    if (s[l] == '(') {
      while (s[r] != ')') r++;
      for (int i = l + 1; i < r; i++) {
        if (OK(s[i]) && !OK(s[i - 1])) {
          cnt++;
        }
      }
      for (int i = l + 1; i < r; i++) s[i] = '_';
    }
    r++;
  }
  for (int i = 0; i < n; i++) {
    if (OK(s[i]))
      sum++;
    else
      sum = 0;
    ans = max(ans, sum);
  }
  printf("%d %d\n", ans, cnt);
}
