#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  s += "_";
  char p = ')';
  int bw = 0, wc = 0, tw = 0;
  for (int i = 0; i <= n; i++) {
    if (s[i] == '(') {
      p = '(';
      if (wc > 0) {
        bw = max(bw, wc);
        wc = 0;
      }
    }
    if (s[i] == ')') {
      p = ')';
      if (wc > 0) {
        tw++;
        wc = 0;
      }
    }
    if (s[i] == '_') {
      if (p == '(' && wc > 0) {
        tw++;
        wc = 0;
      }
      if (p == ')') bw = max(bw, wc);
      wc = 0;
    }
    if (s[i] != '(' && s[i] != ')' && s[i] != '_') wc++;
  }
  cout << bw << " " << tw;
  return 0;
}
