#include <bits/stdc++.h>
using namespace std;
int c, q, e, e1;
vector<int> v;
string s, s1;
int ma = 0;
bool w = true, w1;
int main() {
  cin >> c;
  cin >> s;
  for (int i = 0; i < c; i++) {
    if (s[i] == '(') {
      w = false;
    }
    if (w == false) {
      if (((65 <= (int)s[i] && (int)s[i] <= 90) ||
           (97 <= (int)s[i] && (int)s[i] <= 122))) {
        e = 1;
      } else {
        if (e == 1) {
          e1++;
          e = 0;
        }
        if (s[i] == ')') {
          w = true;
        }
      }
    }
    if (((65 <= (int)s[i] && (int)s[i] <= 90) ||
         (97 <= (int)s[i] && (int)s[i] <= 122)) &&
        w) {
      q += 1;
    } else {
      v.push_back(q);
      q = 0;
    }
    v.push_back(q);
    for (int i = 0; i < v.size(); i++) {
      if (ma < v[i]) {
        ma = v[i];
      }
    }
  }
  cout << ma << " " << e1;
}
