#include <bits/stdc++.h>
const int INF = int(1e9);
const long long INFll = 1ll * INF * INF;
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  s += '_';
  n++;
  int i = -1;
  int k = 0, ans1 = 0;
  string r = "";
  while (i < n) {
    i++;
    if (s[i] == '(') {
      if (r.size() != 0) {
        int x = r.size();
        ans1 = max(ans1, x);
        r = "";
      }
      string t = "";
      while (s[i] != ')') {
        i++;
        if (s[i] != '_' && s[i] != ')') t += s[i];
        if ((s[i] == '_' || s[i] == ')') && t.size() != 0) {
          k++, t = "";
        }
      }
    }
    if (s[i] != '_' && s[i] != ')')
      r += s[i];
    else {
      int x = r.size();
      ans1 = max(ans1, x);
      r = "";
    }
  }
  cout << ans1 << ' ' << k;
}
