#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  string s;
  cin >> s;
  bool bracket = false;
  int outside = 0, inside = 0;
  int cur = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      bracket = true, cur = 0;
    else if (s[i] == ')')
      bracket = false, cur = 0;
    else if (s[i] == '_')
      cur = 0;
    else {
      cur++;
      if (bracket && cur == 1) inside++;
      if (!bracket) outside = max(outside, cur);
    }
  }
  cout << outside << " " << inside << endl;
  return 0;
}
