#include <bits/stdc++.h>
using namespace std;
char s[300];
int main() {
  int n;
  while (cin >> n) {
    int flag = 0;
    s[0] = '_';
    int sum1 = 0, sum2 = 0;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      cin >> s[i];
      if (s[i] == '(') {
        flag = 1;
        ans = 0;
        continue;
      }
      if (s[i] == ')') {
        flag = 0;
        if (isalpha(s[i - 1])) sum1++;
        continue;
      }
      if (s[i] == '_') ans = 0;
      if (flag == 0) {
        if (isalpha(s[i])) {
          ans++;
        }
        if (ans > sum2) sum2 = ans;
      } else {
        if (s[i] == '_' && isalpha(s[i - 1])) {
          sum1++;
        }
      }
    }
    cout << sum2 << " " << sum1 << endl;
  }
}
