#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r1 = 0, r2 = 0;
  cin >> n;
  string str;
  cin >> str;
  for (int i = 0, wl = 0, ib = 0; i < n; i++) {
    if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z')) {
      wl++;
      if (!ib) {
        r1 = max(r1, wl);
      }
    } else {
      if (ib && wl) {
        r2++;
      }
      if (str[i] == '(')
        ib++;
      else if (str[i] == ')')
        ib--;
      wl = 0;
    }
  }
  cout << r1 << " " << r2;
}
