#include <bits/stdc++.h>
using namespace std;
double pi = 4 * atan(1.0);
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans1 = 0, ans2 = 0;
  int f_word = 0, f2 = 0;
  int len = 0;
  for (auto i : s) {
    if (((i >= 'a' && i <= 'z') || (i >= 'A') && (i <= 'Z'))) {
      if (!f_word) {
        len = 1;
        f_word = 1;
        if (f2) ans2++;
      } else {
        len++;
      }
      if (!f2) {
        ans1 = max(ans1, len);
      }
    } else {
      len = 0;
      f_word = 0;
      if (i == '(') f2 = 1;
      if (i == ')') f2 = 0;
    }
  }
  cout << ans1 << ' ' << ans2;
  return 0;
}
