#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n;
char s[N];
void init() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> s[i];
}
void solve() {
  int ans1 = 0, ans2 = 0;
  bool flag = false;
  int tmp = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == ')') {
      flag = false;
      continue;
    }
    if (s[i] == '(') {
      flag = true;
      if (tmp != 0) ans1 = max(ans1, tmp);
      tmp = 0;
      continue;
    }
    if (flag == true) continue;
    if ((s[i] >= 'a') && (s[i] <= 'z'))
      ++tmp;
    else if ((s[i] >= 'A') && (s[i] <= 'Z'))
      ++tmp;
    else {
      ans1 = max(ans1, tmp);
      tmp = 0;
    }
  }
  if (tmp != 0) ans1 = max(ans1, tmp);
  flag = false;
  tmp = 0;
  ans2 = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '(') {
      flag = true;
      continue;
    }
    if (s[i] == ')') {
      flag = false;
      if (tmp != 0) ++ans2;
      tmp = 0;
      continue;
    }
    if (flag == false) continue;
    if (s[i] >= 'a' && s[i] <= 'z')
      ++tmp;
    else if (s[i] >= 'A' && s[i] <= 'Z')
      ++tmp;
    else {
      if (tmp != 0) {
        ++ans2;
        tmp = 0;
      }
      tmp = 0;
    }
  }
  if (tmp != 0) ++ans2;
  cout << ans1 << " " << ans2 << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int __ = 1;
  while (__--) {
    init();
    solve();
  }
}
