#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int N;
  string S;
  cin >> N >> S;
  S += '_';
  int ans1 = 0;
  int ans2 = 0;
  int pre = -1;
  bool inKakko = false;
  for (int i = 0; i <= N; i++) {
    if (S[i] == '(' || S[i] == ')' || S[i] == '_') {
      if (pre != -1) {
        if (inKakko) {
          ans2++;
        } else {
          int len = i - pre;
          ans1 = max(ans1, len);
        }
      }
      pre = -1;
      if (S[i] == '(') {
        inKakko = true;
      }
      if (S[i] == ')') {
        inKakko = false;
      }
      if (S[i] == '_') {
      }
    } else {
      if (pre == -1) {
        pre = i;
      }
    }
  }
  cout << ans1 << " " << ans2 << endl;
}
