#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j, k = 0, cnt = 0, cnt1 = 0, f = 0, f1 = 0, b[300] = {0};
  scanf("%I64d", &n);
  char a[n];
  cin >> a;
  for (i = 0; i < n; i++) {
    f = 0;
    if (a[i] == '(') {
      k++;
      cnt1 = 0;
      for (j = i + 1; a[j] != ')'; j++) {
        if ((a[j] >= 65 && a[j] <= 90) || (a[j] >= 96 && a[j] <= 122)) {
          f = 1;
        } else if (a[j] == '_' && f == 1) {
          cnt++;
          f = 0;
        }
      }
      if (f == 1) cnt++;
      i = j;
    } else if ((a[i] >= 65 && a[i] <= 90) || (a[i] >= 96 && a[i] <= 122)) {
      b[k] = ++cnt1;
      f1 = 1;
    } else if (a[i] == '_' && f1 == 1) {
      k++;
      cnt1 = 0;
      f1 = 0;
    }
  }
  long long int max = 0;
  for (i = 0; i <= k; i++) {
    if (b[i] > b[max]) max = i;
  }
  cout << b[max] << " " << cnt;
  return 0;
}
