#include <bits/stdc++.h>
using namespace std;
int n, i, stat, l0, ans0, ans1;
string s;
bool islet(int k) {
  if (s[k] >= 'A' && s[k] <= 'Z' || s[k] >= 'a' && s[k] <= 'z')
    return true;
  else
    return false;
}
int main() {
  cin >> n;
  cin >> s;
  s = "_" + s + "_";
  n++;
  for (i = 1; i < n; i++) {
    if (islet(i) && islet(i - 1) == false) {
      if (stat == 1)
        ans1++;
      else
        l0 = 1;
    }
    if (islet(i) && islet(i - 1) && stat == 0) l0++;
    if (s[i] == '(') stat = 1;
    if (s[i] == ')') stat = 0;
    ans0 = max(ans0, l0);
  }
  cout << ans0 << " " << ans1 << endl;
}
