#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[10005], r[1005];
  int i, w, x, y, fl, c, l;
  x = 0;
  y = 0;
  cin >> l;
  cin >> s;
  fl = 0;
  i = 0;
  while (i < l) {
    if (s[i] == '_') {
      i++;
    } else if (s[i] == '(') {
      fl = 1;
      i++;
    } else if (s[i] == ')') {
      fl = 0;
      i++;
    } else {
      c = 0;
      while (i < l && s[i] != '_' && s[i] != '(' && s[i] != ')') {
        i++;
        c++;
      }
      if (fl == 1) {
        if (c > 0) y++;
      } else
        x = max(c, x);
    }
  }
  cout << x << " " << y << endl;
  return 0;
}
