#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10;
const int M = 1000000007;
string s;
bool ltr(int i) {
  if (s[i] >= 'a' && s[i] <= 'z') return true;
  if (s[i] >= 'A' && s[i] <= 'Z') return true;
  return false;
}
int main() {
  int n, a = 0, b = 0, cur = 0;
  cin >> n >> s;
  bool f = false;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '(') {
      a = max(a, cur);
      f = true;
      cur = 0;
      continue;
    }
    if (s[i] == ')') {
      if (ltr(i - 1)) ++b;
      f = false;
      cur = 0;
      continue;
    }
    if (ltr(i))
      ++cur;
    else {
      if (!f)
        a = max(a, cur);
      else if (i && ltr(i - 1))
        ++b;
      cur = 0;
    }
  }
  if (ltr(n - 1)) a = max(a, cur);
  cout << a << " " << b;
}
