#include <bits/stdc++.h>
using namespace std;
char s[256];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    getchar();
    bool flag = false;
    int maxn = 0, tot = 0, sum = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%c", &s[i]);
      if (s[i] == '(') {
        flag = true;
        maxn = max(maxn, tot);
        tot = 0;
      } else if (s[i] == ')')
        flag = false;
      else if (s[i] == '_' && !flag) {
        maxn = max(maxn, tot);
        tot = 0;
      } else if ((s[i] >= 'a' && s[i] <= 'z' || s[i] >= 'A' && s[i] <= 'Z') &&
                 flag) {
        if (s[i - 1] == '(' || s[i - 1] == '_') sum++;
      } else if (!flag)
        tot++;
      maxn = max(maxn, tot);
    }
    printf("%d %d\n", maxn, sum);
  }
  return 0;
}
