#include <bits/stdc++.h>
using namespace std;
string espacios(string s) {
  for (int k = 0; k < s.length(); k++) {
    if (s.at(k) == '_') s.at(k) = ' ';
  }
  return s;
}
string parentesis(string s) {
  for (int k = 0; k < s.length(); k++) {
    if (s.at(k) == '(' || s.at(k) == ')') s.at(k) = ' ';
  }
  return s;
}
int maximo(string s) {
  int r = 0;
  istringstream ss;
  ss.str(s);
  while (ss >> s) {
    r = max(r, (int)s.length());
  }
  return r;
}
int contar(string s) {
  int r = 0;
  istringstream ss;
  ss.str(s);
  while (ss >> s) {
    r++;
  }
  return r;
}
int main(int argc, char **argv) {
  int n;
  string s, r;
  cin >> n;
  cin >> s;
  s = espacios(s);
  size_t a, b;
  vector<string> v;
  while (s.find('(') != string::npos) {
    a = s.find('(');
    b = s.find(')');
    r = r + " " + s.substr(a, b - a + 1);
    s = s.substr(0, a) + " " + s.substr(b + 1);
    getchar();
  }
  r = parentesis(r);
  cout << maximo(s) << " " << contar(r) << endl;
  return 0;
}
