#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> out;
  vector<string> inside;
  bool is_ins = false;
  char ch;
  char ch_prev;
  string accum = "";
  for (int i = 0; i < n; ++i) {
    cin >> ch;
    if (ch == '(') {
      if (i > 0 && ch_prev != '_' && ch_prev != ')') {
        out.push_back(accum);
        accum = "";
      }
      is_ins = true;
    } else if (ch == ')') {
      if (i > 0 && ch_prev != '_' && ch_prev != '(') {
        inside.push_back(accum);
        accum = "";
      }
      is_ins = false;
    } else if (ch == '_') {
      if (i > 0 && ch_prev != '_' && ch_prev != '(' && ch_prev != ')') {
        if (is_ins) {
          inside.push_back(accum);
          accum = "";
        } else {
          out.push_back(accum);
          accum = "";
        }
      }
    } else {
      accum += ch;
    }
    ch_prev = ch;
  }
  if (n > 0 && ch_prev != '_' && ch_prev != ')') {
    out.push_back(accum);
  }
  int max = 0;
  for (string word : out) {
    if (word.length() > max) {
      max = word.length();
    }
  }
  cout << max << " " << inside.size() << endl;
  return 0;
}
