#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
long long int dx4[] = {-1, 1, 0, 0};
long long int dy4[] = {0, 0, -1, 1};
long long int dx8[] = {-1, -1, -1, 0, 1, 1, 1, 0};
long long int dy8[] = {-1, 0, 1, 1, 1, 0, -1, -1};
bool isvalid(long long int x, long long int y, long long int n,
             long long int m) {
  return (x >= 0 and y >= 0 and x < n and y < m);
}
long long int isprime[1000];
vector<long long int> prime;
void sievetoprime(long long int n) {
  memset(isprime, true, sizeof(isprime));
  for (long long int p = 2; p * p <= n; p++) {
    if (isprime[p] == true) {
      for (long long int i = p * p; i <= n; i += p) isprime[i] = false;
    }
  }
}
void solve() {
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  string str = "";
  long long int mx = 0, cnt = 0, len = 0;
  bool in = false;
  for (long long int i = 0; i < n; i++) {
    if ((s[i] >= 'A' and s[i] <= 'Z') or (s[i] >= 'a' and s[i] <= 'z')) {
      str += s[i];
    } else if (s[i] == '(') {
      if (str.size() > 0) {
        len = str.size();
        mx = max(mx, len);
        str = "";
        in = true;
      }
      in = true;
    } else if (s[i] == ')') {
      in = false;
      if (str.size() > 0) {
        cnt++;
        str = "";
      }
    } else {
      if (str.size() > 0) {
        if (in == false and s[i] == '_') {
          len = str.size();
          mx = max(mx, len);
          str = "";
        } else if (in == false and s[i] == '(') {
          len = str.size();
          mx = max(mx, len);
          str = "";
          in = true;
        } else if (in == true) {
          cnt++;
          str = "";
          if (s[i] == ')') {
            in = false;
          }
        }
        str = "";
      }
    }
  }
  if (str.size() > 0) {
    len = str.size();
    mx = max(mx, len);
    str = "";
  }
  cout << mx << " " << cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
}
