#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, max_out_len = 0, in_num = 0, temp = 0;
  char a;
  bool is_in = false, pre_eng = false;
  while (scanf("%d", &n) != EOF) {
    getchar();
    max_out_len = 0, in_num = 0, temp = 0;
    is_in = false, pre_eng = false;
    for (int i = 0; i < n; i++) {
      scanf("%c", &a);
      if (is_in) {
        if (a == ')') {
          is_in = false;
          if (pre_eng) {
            in_num++;
          }
          temp = 0;
        } else if (a == '_') {
          if (pre_eng) {
            in_num++;
          }
          pre_eng = false;
        } else {
          pre_eng = true;
          if (i == n - 1) {
            in_num++;
          }
        }
      } else {
        if (a == '(') {
          is_in = true;
          if (temp > max_out_len) {
            max_out_len = temp;
          }
          pre_eng = false;
        } else if (a == '_') {
          if (temp > max_out_len) {
            max_out_len = temp;
          }
          temp = 0;
        } else {
          temp++;
          if (i == n - 1) {
            if (temp > max_out_len) {
              max_out_len = temp;
            }
          }
        }
      }
    }
    printf("%d %d\n", max_out_len, in_num);
  }
  return 0;
}
