#include <bits/stdc++.h>
using namespace std;
char s[300];
int isTu, dangMoNgoac;
int vitri;
int sizeMax, demTu;
int n;
void solve() {
  int i, size;
  size = strlen(s);
  isTu = 0;
  vitri = 0;
  sizeMax = 0;
  dangMoNgoac = 0;
  demTu = 0;
  for (i = 0; i < size; i++) {
    if (s[i] != '_' && s[i] != '(' && s[i] != ')') {
      if (isTu == 0) {
        vitri = i;
        isTu = 1;
      }
    } else {
      if (isTu == 1) {
        if (i - vitri > sizeMax && dangMoNgoac == 0) {
          sizeMax = i - vitri;
        }
        if (dangMoNgoac == 1) {
          demTu++;
        }
        isTu = 0;
      }
      if (s[i] == '(') {
        dangMoNgoac = 1;
      }
      if (s[i] == ')') {
        dangMoNgoac = 0;
      }
    }
  }
  if (isTu == 1) {
    if (i - vitri > sizeMax && dangMoNgoac == 0) {
      sizeMax = i - vitri;
    }
    if (dangMoNgoac == 1) {
      demTu++;
    }
    isTu = 0;
  }
}
void output() { printf("%d %d\n", sizeMax, demTu); }
int main() {
  while (scanf("%d\n", &n) > 0) {
    gets(s);
    solve();
    output();
  }
  return 0;
}
