#include <bits/stdc++.h>
using namespace std;
int main() {
  int len;
  cin >> len;
  char input[300];
  cin >> input;
  int outside = 0;
  int inside = 0;
  int count = 0;
  int num = 0;
  bool bracket = false, counting = false;
  for (int idx = 0; idx <= len - 1; idx++) {
    if ((input[idx] != '_') && (input[idx] != '(') && (input[idx] != ')')) {
      count++;
      if (!counting && bracket) {
        counting = true;
        num++;
      }
    }
    if (bracket) {
      if (count > inside) inside = count;
    } else {
      if (count > outside) outside = count;
    }
    if (input[idx] == '(') {
      bracket = true;
      count = 0;
    }
    if (input[idx] == ')') {
      bracket = false;
      count = 0;
      counting = false;
    }
    if (input[idx] == '_') {
      count = 0;
      counting = false;
    }
  }
  cout << outside << " " << num << endl;
  return 0;
}
