#include <bits/stdc++.h>
double EPS = 1e-9;
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
int n, k;
int main() {
  cin >> n;
  string str;
  cin >> str;
  bool flag = false;
  int ans1 = 0, ans2 = 0, cnt = 0, words = 0;
  for (int i = 0; i < n; i++) {
    if (str[i] == '(') {
      flag = true;
      ans1 = max(ans1, cnt);
      cnt = 0;
    } else if (str[i] == ')') {
      flag = false;
      cnt = 0;
    } else if (str[i] == '_') {
      if (flag) {
        cnt = 0;
      } else {
        ans1 = max(cnt, ans1);
        cnt = 0;
      }
    } else {
      if (flag && cnt == 0) {
        words++;
      }
      cnt++;
    }
  }
  ans1 = max(cnt, ans1);
  cout << ans1 << " " << words << endl;
}
