#include <bits/stdc++.h>
using namespace std;
int n;
string s;
vector<int> x[2];
int out_max, d_in;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> s;
  string tmp = "";
  int flag = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      if (tmp.size()) {
        x[flag].push_back(tmp.size());
      }
      tmp = "";
      flag = 1;
    } else if (s[i] == ')') {
      if (tmp.size()) {
        x[flag].push_back(tmp.size());
      }
      tmp = "";
      flag = 0;
    } else if (s[i] == '_') {
      if (tmp.size()) {
        x[flag].push_back(tmp.size());
      }
      tmp = "";
    } else
      tmp += s[i];
  }
  if (tmp.size()) x[flag].push_back(tmp.size());
  if (x[0].size() == 0)
    cout << 0 << " " << x[1].size();
  else
    cout << *max_element(x[0].begin(), x[0].end()) << " " << x[1].size();
}
