#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300;
char s[MAXN];
int n;
void solve() {
  int maxv = 0, x = 0, y = 0, sum = 0, f = 0;
  s[n++] = '_';
  s[n] = 0;
  for (int i = 0; i < n; ++i) {
    if (!f) {
      if (s[i] == '_') {
        x = 0;
      } else if (s[i] != '(') {
        x++;
        maxv = max(maxv, x);
      } else {
        f = 1;
        x = 0;
      }
    } else {
      if (s[i] == '_') {
        if (y) sum++;
        y = 0;
      } else if (s[i] != ')') {
        y++;
      } else {
        if (y) sum++;
        f = 0, y = 0;
      }
    }
  }
  printf("%d %d\n", maxv, sum);
}
int main() {
  while (~scanf("%d%s", &n, s)) solve();
  return 0;
}
