#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
struct data {
  int el1, el2;
  data() {}
  data(int a, int c) { el1 = a, el2 = c; }
  bool friend operator<(data a, data b) { return a.el1 > b.el1; }
};
int n, m, k;
long long N, M, K;
int main() {
  int t, tc = 1;
  scanf("%d", &n);
  string s;
  cin >> s;
  int cnt1 = 0, cnt2 = 0;
  string a = "";
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      if (a.size() > 0) {
        int p = a.size();
        cnt2 = max(p, cnt2);
      }
      a = "";
      for (int j = i + 1; j < n; j++) {
        if (s[j] == ')') {
          if (a.size() > 0) {
            cnt1++;
          }
          a = "";
          i = j;
          break;
        }
        if (s[j] != '_') {
          a += s[j];
        } else {
          if (a.size() > 0) {
            cnt1++;
          }
          a = "";
        }
      }
    } else {
      if (s[i] == '_') {
        int p = a.size();
        cnt2 = max(p, cnt2);
        a = "";
      } else {
        a += s[i];
      }
    }
  }
  int p = a.size();
  cnt2 = max(p, cnt2);
  printf("%d %d\n", cnt2, cnt1);
  return 0;
}
