#include <bits/stdc++.h>
using namespace std;
const int N = 100008;
bool prime[N];
int arr[N];
bool isprime(int n) {
  if (n <= 1) return 0;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return prime[n] = true;
}
void feilprime() {
  prime[0] = prime[1] = 0;
  for (int i = 2; i * i <= 300; i++) {
    if (isprime(i))
      for (int j = i + i; j < 300; j += i) prime[j] = 0;
  }
}
string DecToBinary(int num, string s) {
  if (num < 2)
    cout << num;
  else {
    DecToBinary(num / 2, s);
    s += num % 2;
  }
  return s;
}
bool isVowel(char c) {
  if (c == 'a' || c == 'y' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
    return true;
  return false;
}
bool isAlpha(char c) {
  if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) return true;
  return false;
}
int a[3][3];
int main() {
  int n;
  scanf("%d", &n);
  char c[260];
  scanf("%s", &c);
  string s = c;
  int maxWord = 0, numOfWords = 0;
  int temp1 = 0;
  bool inside = false, found = false;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      inside = true;
    }
    if (s[i] == ')') {
      inside = false;
    }
    if (isAlpha(s[i]) && !inside) {
      temp1++;
    } else {
      maxWord = max(temp1, maxWord);
      temp1 = 0;
    }
    if (isAlpha(s[i]) && inside) {
      found = true;
    } else {
      if (found) {
        numOfWords++;
        found = false;
      }
    }
  }
  maxWord = max(maxWord, temp1);
  cout << maxWord << " " << numOfWords << endl;
  return 0;
}
