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