#include <bits/stdc++.h>
using namespace std;
long long ar[1000009], pr[1000009], ap[1000009];
vector<long long> vec, vecc;
map<long long, long long> mymap;
string aa, dd, ff, gg;
char ss[1000009];
vector<pair<long long, long long> > KEEP;
int main() {
  long long i, j, k, l, n, m, ind, sum, tot, temp, flag, ans, now, noww, b, w,
      ans1, ans2, cnt1, cnt2, flag1, flag2;
  cin >> n;
  cin >> aa;
  aa = "()" + aa;
  n = aa.size();
  for (i = 0; i < n; i++)
    if (aa[i] >= 'A' && aa[i] <= 'Z') aa[i] = tolower(aa[i]);
  ans = 0;
  for (i = 0; i < n; i++) {
    if (aa[i] != '(') continue;
    for (j = i + 1; j < n; j++) {
      if (aa[j] == ')') break;
      if ((aa[j - 1] < 'a' || aa[j - 1] > 'z') &&
          (aa[j] >= 'a' && aa[j] <= 'z'))
        ans++;
    }
  }
  temp = ans;
  ans = 0;
  for (i = 0; i < n; i++) {
    if (aa[i] == '(') continue;
    if (aa[i] == ')') continue;
    if (aa[i - 1] >= 'a' && aa[i - 1] <= 'z') continue;
    if (aa[i] < 'a' || aa[i] > 'z') continue;
    flag = 0;
    for (j = i - 1; j >= 0 && flag == 0; j--) {
      if (aa[j] == '(') flag = 1;
      if (aa[j] == ')') flag = 2;
    }
    if (flag == 2) {
      j = i;
      while (j < n && aa[j] >= 'a' && aa[j] <= 'z') j++;
      ans = max(ans, j - i);
      i = j;
    }
  }
  cout << ans << " " << temp << endl;
}
