#include <bits/stdc++.h>
using namespace std;
const short Nmax = 260;
char a[Nmax];
int n;
inline bool Lit(char ch) {
  return (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z'));
}
int main() {
  int nrc, cuvmax, s;
  bool ok = false;
  cin >> n;
  cin >> (a + 1);
  nrc = cuvmax = 0;
  for (int i = 1; i <= n;) {
    if (a[i] == '(') {
      i++;
      ok = true;
    } else if (a[i] == ')') {
      i++;
      ok = false;
    } else if (Lit(a[i])) {
      s = 0;
      while (Lit(a[i]) && i <= n) {
        s++;
        i++;
      }
      if (ok == false)
        cuvmax = max(cuvmax, s);
      else
        nrc++;
    } else
      i++;
  }
  cout << cuvmax << " " << nrc << "\n";
  return 0;
}
