#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, str;
  long long n;
  cin >> n;
  getchar();
  vector<string> v;
  cin >> s;
  long long p = s.size();
  for (int i = 0; i < p; i++) {
    if (s[i] == '_')
      str += ' ';
    else if (s[i] == '(') {
      str += ' ';
      str += s[i];
      str += ' ';
    } else if (s[i] == ')') {
      str += ' ';
      str += s[i];
      str += ' ';
    } else
      str += s[i];
  }
  long long r = str.size();
  istringstream ss(str);
  while (ss) {
    string word;
    ss >> word;
    v.push_back(word);
  }
  long long t = v.size();
  long long c = 0, d = 0;
  for (int i = 0; i < t; i++) {
    if (v[i] == "(") {
      long long j = i + 1;
      while (v[j] != ")") {
        c++;
        j++;
      }
      i = j;
    } else {
      long long k = v[i].size();
      d = (d > k) ? d : k;
    }
  }
  cout << d << " " << c << endl;
  return 0;
}
