#include <bits/stdc++.h>
const long long oo = 1e9;
const long long mod = 95542721;
const long long MAX = 1e9;
const long long ARR = 300000;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int a = 0, b = 0, n, len = 0, flag = 0;
  string s;
  cin >> n;
  cin >> s;
  for (long long i = (0); i < (long long)(s.length()); ++i) {
    if (!isalpha(s[i]) && !flag) {
      a = max(a, len);
      len = 0;
    } else if (!flag) {
      len++;
    }
    if (s[i] == '(') {
      flag = 1;
    }
    if (flag) {
      if (i - 1 >= 0) {
        if (isalpha(s[i - 1]) && (s[i] == ')' || s[i] == '_')) {
          b++;
        }
      }
    }
    if (s[i] == ')') {
      flag = 0;
    }
  }
  if (isalpha(s[s.length() - 1])) {
    a = max(a, len);
  }
  cout << a << " " << b;
  return 0;
}
