#include <bits/stdc++.h>
using namespace std;
const int MAXN = 255 + 5;
int n;
char word[MAXN];
int khw_len;
int khn_cnt;
bool inkh;
int tmp;
int main() {
  scanf("%d\n", &n);
  while (!word[1] || (strlen(word + 1) != n)) gets(word + 1);
  for (int i = 1; i <= n; i++) {
    if (!isalpha(word[i]) && !inkh) {
      khw_len = max(khw_len, tmp);
      tmp = 0;
    }
    if (!inkh && isalpha(word[i])) tmp++;
    if (i == n && !inkh && isalpha(word[i])) {
      khw_len = max(khw_len, tmp);
      tmp = 0;
    }
    if (inkh && !isalpha(word[i]) && isalpha(word[i - 1])) khn_cnt++;
    if (word[i] == '(') inkh = true;
    if (word[i] == ')') inkh = false;
  }
  printf("%d %d\n", khw_len, khn_cnt);
  return 0;
}
