#include <bits/stdc++.h>
using namespace std;
int dx[8] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy[8] = {1, -1, 0, -1, 1, 1, 0, -1};
int main() {
  ios::sync_with_stdio(false);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  string s, in = "", out = "";
  int cnt = 0, mx = 0;
  cin >> n >> s;
  s += "_";
  for (int i = 0; i < n + 1; i++) {
    if (s[i] == '(') {
      if (out != "") {
        mx = max(mx, ((int)((out).size())));
        out = "";
      }
      in = "";
      while (s[++i] != ')') {
        if (s[i] == '_') {
          if (in != "") {
            in = "";
            cnt++;
          }
        } else
          in += s[i];
      }
      if (in != "") {
        in = "";
        cnt++;
      }
    } else if (s[i] == '_') {
      if (out != "") {
        mx = max(mx, ((int)((out).size())));
        out = "";
      }
    } else
      out += s[i];
  }
  cout << mx << " " << cnt;
  return 0;
}
