#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char s[255];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> s[i];
  int max_length = 0;
  int num = 0;
  bool in = false;
  int word_length = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      in = true;
      if (word_length > max_length) max_length = word_length;
      word_length = 0;
    } else if (s[i] == ')') {
      in = false;
      if (word_length > 0) num++;
      word_length = 0;
    } else if (s[i] == '_') {
      if (in && word_length > 0)
        num++;
      else if (!in && word_length > max_length)
        max_length = word_length;
      word_length = 0;
    } else {
      word_length++;
      if (i == n - 1 && word_length > max_length) max_length = word_length;
    }
  }
  cout << max_length << " " << num << endl;
}
