#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  int m = str.length();
  int cnt = 0, count = 0;
  bool found = false, ans = false, no = false;
  vector<int> a;
  a.push_back(0);
  for (int i = 0; i < m;) {
    if (str[i] == '_') {
      i++;
      while ((int)str[i] >= 65 && (int)str[i] <= 90 ||
             (int)str[i] >= 96 && (int)str[i] <= 122) {
        cnt++;
        i++;
        if (i == m - 1) break;
      }
      if (found) {
        if (cnt > 0) count++;
        cnt = 0;
      } else {
        if (cnt > 0) a.push_back(cnt);
        cnt = 0;
      }
    } else if (str[i] == '(') {
      i++;
      found = true;
      while ((int)str[i] >= 65 && (int)str[i] <= 90 ||
             (int)str[i] >= 96 && (int)str[i] <= 122) {
        cnt++;
        i++;
      }
      if (cnt > 0) count++;
      cnt = 0;
    } else if (str[i] == ')') {
      found = false;
      ans = true;
      i++;
      while (((int)str[i] >= 65 && (int)str[i] <= 90 ||
              (int)str[i] >= 96 && (int)str[i] <= 122) &&
             i < m) {
        cnt++;
        i++;
        a.push_back(cnt);
      }
      cnt = 0;
    } else {
      while (((int)str[i] >= 65 && (int)str[i] <= 90 ||
              (int)str[i] >= 96 && (int)str[i] <= 122) &&
             i < m) {
        cnt++;
        i++;
        a.push_back(cnt);
      }
      cnt = 0;
    }
  }
  sort(a.begin(), a.end());
  cout << a[a.size() - 1] << " " << count << endl;
}
