#include <bits/stdc++.h>
using namespace std;
template <class T>
void scanint(T& x) {
  register int c = getchar();
  x = 0;
  int m = 0;
  for (; isspace(c); c = getchar())
    ;
  if (c == '-') {
    m = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (m == 1) {
    x *= -1;
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string w;
  cin >> w;
  int s = 0;
  int wl = 0, mwl = 0, wCount = 0;
  bool wStarted = false;
  for (int i = 0; i < n; ++i) {
    if (s == 0) {
      if (isalpha(w[i])) {
        wl++;
        mwl = max(wl, mwl);
      } else {
        wl = 0;
      }
    } else {
      if (isalpha(w[i]) && wStarted) {
        continue;
      } else if (isalpha(w[i])) {
        wStarted = true;
      } else if (wStarted) {
        ++wCount;
        wStarted = false;
      }
    }
    if (w[i] == '(') {
      s = 1;
    }
    if (w[i] == ')') {
      s = 0;
      wStarted = false;
    }
  }
  cout << mwl << " " << wCount;
  return 0;
}
