#include <bits/stdc++.h>
using namespace std;
int bigPWord(string inP) {
  int size = 0, cur = 0, ans = 0;
  while (cur < inP.size()) {
    int cSize = 0;
    bool flag = false;
    while (cur < inP.size() and inP[cur] != '_' and inP[cur] != '(' and
           inP[cur] != ')') {
      cur++;
      cSize++;
      flag = true;
    }
    if (flag) ans++;
    cur++;
    size = max(size, cSize);
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int oP = 0, iP = 0;
  cerr << "WTF?" << endl;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '(') {
      int j = i + 1;
      while (s[j] != ')') j++;
      iP += bigPWord(s.substr(i + 1, j - i - 1));
      i = j;
      continue;
    }
    int cS = 0;
    bool flag = false;
    while (i < s.size() and s[i] != '_' and s[i] != '(' and s[i] != ')') {
      cS++;
      i++;
      flag = true;
    }
    if (flag) i--;
    oP = max(oP, cS);
  }
  cout << oP << " " << iP << endl;
  return 0;
}
