#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 0;
  string s;
  cin >> n >> s;
  int length = 0, count = 0, l = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '_')
      length = 0;
    else if (s[i] == '(') {
      l = 0;
      while (1) {
        i++;
        if (s[i] == '_') {
          if (l != 0) count++;
          l = 0;
        } else if (s[i] == ')') {
          if (l != 0) count++;
          break;
        } else
          l++;
      }
      length = 0;
    } else
      length++;
    m = max(length, m);
  }
  cout << m << " " << count;
}
