#include <bits/stdc++.h>
using namespace std;
void YES_NO(bool ok) {
  if (ok)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  exit(0);
}
int maxlen = 0, cnt = 0;
void work(int len) {
  if (len != 0) ++cnt;
}
void work2(int len) { maxlen = max(maxlen, len); }
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int balance = 0;
  int i = 0;
  int len = 0;
  while (i < s.size()) {
    if (s[i] == '(') {
      ++balance;
      if (balance != 1) work(len);
      if (balance == 1) work2(len);
      len = 0;
    } else if (s[i] == ')') {
      --balance;
      work(len);
      len = 0;
    } else if (s[i] == '_') {
      if (balance != 0) work(len);
      if (balance == 0) work2(len);
      len = 0;
    } else
      ++len;
    ++i;
  }
  maxlen = max(maxlen, len);
  cout << maxlen << " " << cnt << endl;
  return 0;
}
