#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 0, j = 0;
  string a;
  cin >> n >> a;
  set<int> t;
  for (int i = 0; i < n; i++) {
    while (a[i] != '_' && a[i] != '(' && i < n) {
      m++;
      i++;
    }
    t.insert(m);
    m = 0;
    if (a[i] == '(') {
      i++;
      for (int k = i; k < n; k++) {
        if (a[k] != '_' && a[k] != ')') {
          j++;
          while (a[k] != '_' && a[k] != ')') k++;
        }
        i = k;
        if (a[i] == ')') break;
      }
    }
  }
  if (!t.empty()) {
    set<int>::iterator it = t.end();
    it--;
    cout << *it << "  " << j;
  } else
    cout << "0  " << j;
}
