#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int len;
  cin >> len;
  string str;
  cin >> str;
  int longestOut = 0;
  int inside = 0;
  bool outside = true;
  int length = 0;
  for (int i = 0; i < len; ++i) {
    if (str[i] == '(' || str[i] == ')' || str[i] == '_') {
      if (length > 0) {
        if (!outside)
          inside++;
        else
          longestOut = max(longestOut, length);
        length = 0;
      }
    } else
      length++;
    if (str[i] == '(')
      outside = false;
    else if (str[i] == ')') {
      outside = true;
    }
  }
  longestOut = max(longestOut, length);
  cout << longestOut << " " << inside << endl;
  return 0;
}
