#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  s += '_';
  int ln = 0, lng = 0, imin = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '(') {
      imin = 1;
      ln = 0;
    } else if (s[i] == ')') {
      imin = 0;
      ln = 0;
    } else if (!imin) {
      if (s[i] != '_') {
        ln++;
        lng = max(lng, ln);
      } else
        ln = 0;
    } else
      ln = 0;
  }
  cout << lng << " ";
  imin = 0, ln = 0;
  int cnt = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '(') {
      imin = 1;
      ln = 0;
    } else if (s[i] == ')') {
      imin = 0;
      if (ln) cnt++;
      ln = 0;
    } else if (imin) {
      if (s[i] != '_')
        ln++;
      else {
        if (ln) cnt++;
        ln = 0;
      }
    } else
      ln = 0;
  }
  cout << cnt << endl;
  return 0;
}
