#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i = 0, count1 = 0, count2 = 0, big = 0;
  cin >> n;
  char arr[n];
  cin >> arr;
  while (arr[i] != '\0') {
    if ((arr[i] >= 'a' && arr[i] <= 'z') || (arr[i] >= 'A' && arr[i] <= 'Z'))
      big++;
    else {
      big = 0;
      if (arr[i] == '(') {
        while (arr[i] != ')') {
          if ((arr[i] >= 'a' && arr[i] <= 'z') ||
              (arr[i] >= 'A' && arr[i] <= 'Z'))
            if (arr[i + 1] == '_' || arr[i + 1] == ')') count2++;
          i++;
        }
      }
    }
    if (big > count1) count1 = big;
    i++;
  }
  cout << count1 << " " << count2;
  return 0;
}
