#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int ma = 0;
  cin >> n;
  int pos;
  string s, words;
  cin >> s;
  while ((pos = s.find_first_of("(")) != -1) {
    int pos1 = s.find_first_of(")", pos);
    words += '_' + s.substr(pos + 1, pos1 - 1 - pos);
    s = ((pos >= 0) ? s.substr(0, pos) : "") + "_" +
        (pos1 + 1 <= s.length() ? (s.substr(pos1 + 1)) : "");
  }
  int ma2 = 0, ma1 = 0;
  while ((pos = words.find_first_of("_")) != -1) {
    if (pos > 0 && words[pos - 1] != '_') {
      ma1++;
    }
    if (pos + 1 <= words.length())
      words = words.substr(pos + 1);
    else
      words = "";
  }
  ma1 = (!words.empty() ? ma1 + 1 : ma1);
  while ((pos = s.find_first_of("_")) != -1) {
    ma2 = max(ma2, pos);
    if (pos + 1 <= s.length())
      s = s.substr(pos + 1);
    else
      s = "";
  }
  ma2 = max(ma2, (int)s.length());
  cout << ma2 << " " << ma1;
}
