#include <bits/stdc++.h>
const int maxn = 1025;
const int maxm = 10;
using namespace std;
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  int ans1 = 0, ans2 = 0;
  int cnt1 = 0;
  int f = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '(') {
      f = 1;
      ans1 = max(ans1, cnt1);
      cnt1 = 0;
      continue;
    }
    if (s[i] == ')') {
      f = 0;
      continue;
    }
    if (!f) {
      if (s[i] != '_') {
        cnt1++;
      } else {
        ans1 = max(ans1, cnt1);
        cnt1 = 0;
      }
    }
    if (f) {
      if ((s[i - 1] == '(' || s[i - 1] == '_') && s[i] != '_') {
        ans2++;
      }
    }
  }
  ans1 = max(ans1, cnt1);
  cnt1 = 0;
  cout << ans1 << " " << ans2 << endl;
  return 0;
}
