#include <bits/stdc++.h>
using namespace std;
vector<long long int> pref(100001);
int main() {
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  long long int i, j;
  stack<char> st;
  long long int cnt = 0;
  long long int ans1 = 0;
  long long int cnt2 = 0;
  long long int ans = 0;
  for (i = 0; i < n; i++) {
    if (s[i] == '(') {
      cnt2 = max(cnt2, ans);
      ans = 0;
      st.push(s[i]);
      continue;
    }
    if (s[i] == ')') {
      if (ans1 == 1) {
        cnt++;
        ans1 = 0;
      }
      st.pop();
      continue;
    }
    if (!st.empty()) {
      if (s[i] != '_' && ans1 == 0) {
        ans1 = 1;
      } else if (s[i] == '_' && ans1 == 1) {
        cnt++;
        ans1 = 0;
      }
    } else {
      if (s[i] == '_' && ans == 0) {
      } else if (s[i] == '_' && ans != 0) {
        cnt2 = max(cnt2, ans);
        ans = 0;
      } else {
        ans++;
      }
    }
  }
  cnt2 = max(cnt2, ans);
  cout << cnt2 << " " << cnt << endl;
}
