#include <bits/stdc++.h>
using namespace std;
int l, n, m, mi = 100000, f, in, cnt, ma, j;
string s;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    j = i;
    while ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) i++;
    if (i != j)
      if (!in)
        ma = max(i - j, ma);
      else
        cnt++;
    if (s[i] == '(')
      in = 1;
    else if (s[i] == ')')
      in = 0;
  }
  cout << ma << " " << cnt << endl;
  return 0;
}
