#include <bits/stdc++.h>
using namespace std;
const int N = 3e2 + 9;
int n;
char a[N];
void home() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void enter() { cin >> n; }
bool check(char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); }
void solve() {
  bool ok = false;
  int id = 0, l = 0;
  int res1 = 0, res2 = 0;
  for (int i = (1); i <= (n + 1); ++i) {
    if (i > n)
      a[i] = '_';
    else
      cin >> a[i];
    if (a[i] == '(')
      ok = true;
    else if (a[i] == ')')
      ok = false, l = 0;
    else if (ok) {
      if (check(a[i]) && !check(a[i - 1])) res2++;
    } else if (!ok) {
      if (check(a[i]))
        l++;
      else
        l = 0;
      res1 = ((res1) > (l) ? (res1) : (l));
    }
  }
  cout << res1 << " " << res2;
}
int main() {
  home();
  enter();
  solve();
}
