#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  bool ip = false;
  char p;
  std::cin >> p;
  char c;
  int cwc = 0;
  int wip = 0;
  int m = 0;
  if (p == '(')
    ip = true;
  else if (p != '_') {
    cwc++;
    m = 1;
  }
  for (int i = 1; i < n; i++) {
    std::cin >> c;
    if (c == ')') {
      ip = false;
      if (cwc != 0) wip++;
      cwc = 0;
    } else if (c == '_') {
      if (ip && cwc != 0) wip++;
      if (!ip) m = m > cwc ? m : cwc;
      cwc = 0;
    } else if (c == '(') {
      m = m > cwc ? m : cwc;
      ip = true;
      cwc = 0;
    } else {
      cwc++;
    }
  }
  m = m > cwc ? m : cwc;
  std::cout << m << " " << wip << std::endl;
}
