#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, wordCount = 0, inParCount = 0, wordLen = 0, maxSize = 0;
  string s;
  scanf("%d\n", &n);
  getline(cin, s);
  bool inPar = false;
  bool openUnder = false;
  for (i = 0; i < n; i++) {
    if (((s[i] >= 'A') && (s[i] <= 'Z')) || ((s[i] >= 'a') && (s[i] <= 'z'))) {
      wordLen++;
      continue;
    } else
      break;
  }
  if (wordLen > maxSize) maxSize = wordLen;
  wordLen = 0;
  for (i; i < n; i++) {
    if (((s[i] >= 'A') && (s[i] <= 'Z')) || ((s[i] >= 'a') && (s[i] <= 'z'))) {
      wordLen++;
      continue;
    } else {
      if (s[i] == '(') {
        if (wordLen > maxSize) {
          maxSize = wordLen;
        }
        inPar = true;
        wordLen = 0;
      } else if (s[i] == ')') {
        if (inPar == true) {
          if (wordLen > 0) inParCount++;
          inPar = false;
          wordLen = 0;
        }
      } else if (s[i] == '_') {
        if (inPar == true) {
          if (wordLen > 0) inParCount++;
          wordLen = 0;
        } else {
          if (wordLen > maxSize) {
            maxSize = wordLen;
          }
          wordLen = 0;
        }
      }
    }
  }
  if (wordLen > maxSize) maxSize = wordLen;
  cout << maxSize << " " << inParCount;
}
