#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i, w;
  char arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int wordsIn = 0, longest = 0;
  bool inPa = false;
  int len = 0;
  int lenb = 0;
  int realLongest = 0;
  for (i = 0; i < n; i++) {
    if (len == 1) {
      wordsIn++;
    }
    if (arr[i] == ')') {
      if (len > longest) {
        longest = len;
      }
      len = 0;
      inPa = !inPa;
      continue;
    }
    if (arr[i] == '(') {
      if (lenb > realLongest) {
        realLongest = lenb;
      }
      lenb = 0;
      inPa = !inPa;
      continue;
    }
    if (inPa) {
      if (arr[i] == '_') {
        if (len > longest) {
          longest = len;
        }
        len = 0;
        continue;
      } else {
        len++;
      }
    } else {
      if (arr[i] == '_') {
        if (lenb > realLongest) {
          realLongest = lenb;
        }
        lenb = 0;
        continue;
      } else {
        lenb++;
      }
    }
  }
  if (len == 1) {
    wordsIn++;
  }
  if (lenb > realLongest) {
    realLongest = lenb;
  }
  cout << realLongest << " " << wordsIn;
  return 0;
}
