#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<char> arr;
  arr.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  bool major = false;
  int last_loc = 0;
  int par_loc = 0;
  vector<int> sizes;
  int words = 0;
  int s = 0;
  if (arr[0] != '_' && arr[0] != '(') {
    last_loc = -1;
  }
  for (int i = 0; i < n; i++) {
    if (major) {
      if (arr[i] == '_' && arr[i - 1] != '_' && arr[i - 1] != '(') {
        words++;
        par_loc = i;
      }
      if (arr[i] == '_') {
        par_loc = i;
      }
      if (arr[i] == ')') {
        last_loc = i;
        if ((par_loc + 1) != i) {
          words++;
        }
        major = false;
      }
    } else {
      if (arr[i] == '(') {
        major = true;
      }
      if (((arr[i] == '_' || arr[i] == ')' || arr[i] == '(') &&
           i != last_loc + 1 && i != last_loc) ||
          (i == (n - 1))) {
        if (i == (n - 1)) {
          if (((arr[i] == '_' || arr[i] == ')' || arr[i] == '(') &&
               i != last_loc + 1 && i != last_loc)) {
          } else {
            i += 1;
          }
        }
        if ((i - last_loc + 1) != 0) {
          sizes.push_back(i - last_loc - 1);
        } else {
          sizes.push_back(1);
        }
        s++;
        last_loc = i;
      }
      if (arr[i] == '(') {
        last_loc = i;
        par_loc = i;
      }
      if (arr[i] == '_') {
        last_loc = i;
      }
    }
  }
  sizes.resize(s);
  sort(sizes.begin(), sizes.end());
  reverse(sizes.begin(), sizes.end());
  cout << ((s == 0) ? 0 : sizes[0]) << " " << words;
  return 0;
}
