#include <bits/stdc++.h>
using namespace std;
int main() {
  int len;
  string str;
  cin >> len >> str;
  int word_cnt = 0;
  int max_cnt = 0;
  bool is_consec;
  is_consec = 0;
  bool is_open = 0;
  bool is_word = 0;
  for (int i = 0; i < len; i++) {
    if (str[i] == '(') {
      is_open = 1;
    }
    if (str[i] == ')') {
      is_open = 0;
    }
    if (isalpha(str[i]) != 0) {
      if (is_open == 0) {
        word_cnt++;
        if (word_cnt > max_cnt) {
          max_cnt = word_cnt;
        }
      }
    } else {
      word_cnt = 0;
    }
  }
  cout << max_cnt << " ";
  is_open = is_word = 0;
  int hi = 0;
  for (int i = 0; i < len; i++) {
    if (str[i] == '(') {
      is_open = 1;
    }
    if (str[i] == ')') {
      is_open = 0;
      is_word = 0;
    }
    if (isalpha(str[i]) != 0) {
      if (is_open == 1) {
        if (is_word == 0) {
          hi++;
        }
        is_word = 1;
      }
    }
    if (isalpha(str[i]) == 0) {
      is_word = 0;
    }
  }
  cout << hi << endl;
  return 0;
}
