#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int MaxWord = 0;
  int WordsInBrackets = 0;
  int Brackets = 0;
  int Word = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == '_') {
      if (Word > MaxWord) {
        MaxWord = Word;
      }
      Word = 0;
    } else if (S[i] == '(' or S[i] == ')') {
      Brackets = 1 - Brackets;
      if (Word > MaxWord) {
        MaxWord = Word;
      }
      Word = 0;
    } else {
      if (Brackets == 1) {
        if (S[i - 1] == '_' or S[i - 1] == '(' or S[i - 1] == ')') {
          WordsInBrackets++;
        }
      } else {
        Word++;
      }
    }
  }
  if (Word > MaxWord) {
    MaxWord = Word;
  }
  cout << MaxWord << " " << WordsInBrackets;
  return 0;
}
