#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int co = 0;
  int len = 0;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      int k = i;
      for (; k < n; k++) {
        if (s[k] == ')')
          break;
        else if ((s[k] >= 'A' && s[k] <= 'Z') || (s[k] >= 'a' && s[k] <= 'z')) {
          int j = k;
          for (; j < n; j++) {
            if (s[j] == '_' || s[j] == ')') break;
          }
          sum++;
          k = j - 1;
        }
      }
      i = k - 1;
    } else if ((s[i] >= 'A' && s[i] <= 'Z') || (s[i] >= 'a' && s[i] <= 'z')) {
      int h = i;
      for (; h < n; h++) {
        if (s[h] == '_' || s[h] == '(') break;
        co++;
      }
      i = h - 1;
      len = max(len, co);
      co = 0;
    }
  }
  len = max(len, co);
  cout << len << ' ' << sum << endl;
  return 0;
}
