#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 0, word = 0;
  cin >> n;
  cin.ignore();
  vector<int> v;
  bool flag_par = false, flag_word = false;
  for (int i = 0; i < n; i++) {
    char x;
    cin >> x;
    if (x == '(') {
      flag_par = true;
    }
    if (x == ')') {
      flag_par = flag_word = false;
    }
    if (flag_par) {
      if (x == '_') {
        flag_word = false;
      }
      if (flag_word) {
        continue;
      }
      if (x != '_' && x != '(' && x != ')') {
        word++;
        flag_word = true;
      }
    }
    if (!flag_par) {
      if (x != '_' && x != '(' && x != ')') {
        cnt++;
      }
      if (x == '_' || x == '(' || x == ')' || i == (n - 1)) {
        v.push_back(cnt);
        cnt = 0;
      }
    }
  }
  if (v.size() == 0) {
    cout << "0"
         << " " << word << endl;
  } else {
    sort(v.begin(), v.end());
    cout << v.at(v.size() - 1) << " " << word << endl;
  }
  return 0;
}
