#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 300 + 10;
int n;
char str[MAXN];
int main() {
  while (~scanf("%d", &n)) {
    scanf("%s", str);
    bool inner = false;
    int maxlen = 0, cnt = 0;
    for (int i = 0; i < strlen(str); i++) {
      if (str[i] == '_') {
        continue;
      }
      if (str[i] == '(') {
        int k = i + 1;
        bool haschar = false;
        for (; k < strlen(str); k++) {
          if (str[k] == ')') {
            cnt += (haschar ? 1 : 0);
            i = k;
            break;
          }
          if (str[k] == '_') {
            cnt += (haschar ? 1 : 0);
            haschar = false;
          } else {
            haschar = true;
          }
        }
      } else {
        int k = i;
        int tmplen = 0;
        for (; k <= strlen(str); k++) {
          if (k == strlen(str)) {
            maxlen = max(maxlen, tmplen);
            i = k;
            break;
          } else if (str[k] == '_') {
            maxlen = max(maxlen, tmplen);
            tmplen = 0;
            continue;
          } else if (str[k] == '(') {
            maxlen = max(maxlen, tmplen);
            i = k - 1;
            break;
          } else {
            tmplen++;
          }
        }
      }
    }
    printf("%d %d\n", maxlen, cnt);
  }
  return 0;
}
