#include <bits/stdc++.h>
using namespace std;
vector<long long> a, b;
int main() {
  string s;
  long long n;
  cin >> n;
  cin >> s;
  int fl = 0;
  long long siz = 0, cnt = 0;
  string word;
  for (int i = 0; i < s.size(); ++i) {
    if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) {
      word += s[i];
    }
    if (s[i] == '_') {
      if (fl == 1) {
        if (word != "") ++cnt;
      } else {
        siz = max(siz, (long long)word.size());
      }
      word = "";
    }
    if (s[i] == '(') {
      if (fl == 0) siz = max(siz, (long long)word.size());
      word = "";
      fl = 1;
    }
    if (s[i] == ')') {
      if (word != "") ++cnt;
      word = "";
      fl = 0;
    }
  }
  siz = max(siz, (long long)word.size());
  cout << siz << " " << cnt << endl;
  return 0;
}
