#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
  cin >> n >> s;
  int num = 0, MAX = 0;
  bool f = 0, g = 0;
  int ans = 0;
  for (long long i = 0; i < (n); i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      s[i] -= 'A';
      s[i] += 'a';
    }
  }
  for (long long i = 0; i < (n); i++) {
    if (s[i] == '(') {
      f = 1;
      g = 1;
      MAX = max(num, MAX);
      num = 0;
      continue;
    } else if (s[i] == ')') {
      f = 0;
      continue;
    }
    if (f) {
      if (s[i] >= 'a' && s[i] <= 'z') {
        if (g) {
          g = 0;
          ans++;
        }
      } else {
        g = 1;
      }
    } else {
      if (s[i] >= 'a' && s[i] <= 'z') {
        num++;
      } else {
        MAX = max(num, MAX);
        num = 0;
      }
    }
  }
  MAX = max(num, MAX);
  cout << MAX << " " << ans << endl;
}
