#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010];
map<string, bool> mark;
bool word(char a) {
  if (a >= 'a' and a <= 'z') return true;
  if (a >= 'A' and a <= 'Z') return true;
  return false;
}
int main() {
  int n;
  cin >> n;
  string a;
  cin >> a;
  int ind = 0;
  int inside = 0;
  int ans1 = 0;
  int ans2 = 0;
  while (ind < n) {
    if (a[ind] == '_') {
      ind++;
      continue;
    }
    if (a[ind] == '(') {
      inside++;
      ind++;
      continue;
    }
    if (a[ind] == ')') {
      inside--;
      ind++;
      continue;
    }
    int leng = 0;
    string cur = "";
    while (word(a[ind]) == true) {
      if (ind == n - 1) {
        cur += a[ind];
        if (inside > 0) {
          ans2++;
        }
        if (inside == 0) {
          ans1 = max(ans1, int(cur.size()));
        }
        ind++;
        break;
      }
      cur += a[ind];
      ind++;
    }
    if (ind == n) {
      break;
    }
    if (inside > 0) {
      ans2++;
    }
    if (inside == 0) {
      ans1 = max(ans1, int(cur.size()));
    }
  }
  cout << ans1 << ' ' << ans2 << endl;
}
