public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  int n = sc . nextInt ( ) ;
  char [ ] c = sc . next ( ) . toCharArray ( ) ;
  int wip = 0 , max = 0 , len ;
  int j ;
  for ( int i = 0 ;
  i < n ;
  ) {
    if ( c [ i ] == '(' ) {
      j = i + 1 ;
      while ( c [ j ] != ')' ) {
        len = 0 ;
        while ( j < n && c [ j ] != '_' && c [ j ] != ')' ) {
          len ++ ;
          j ++ ;
        }
        if ( len > 0 ) wip ++ ;
        if ( c [ j ] == '_' ) j ++ ;
      }
      j ++ ;
      i = j ;
    }
    else if ( c [ i ] != '_' ) {
      j = i + 1 ;
      while ( j < n && c [ j ] != '_' && c [ j ] != '(' && c [ j ] != ')' ) {
        j ++ ;
      }
      max = Math . max ( max , j - i ) ;
      i = j ;
    }
    else i ++ ;
  }
  System . out . println ( max + " " + wip ) ;
  sc . close ( ) ;
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; char [ ] c = sc . next ( ) . toCharArray ( ) ; int wip = 0 , max = 0 , len ; int j ; for ( int i = 0 ; i < n ; ) { if ( c [ i ] == ' ( ' ) { j = i + 1 ; while ( c [ j ] != ' ) ' ) { len = 0 ; while ( j < n && c [ j ] != ' _ ' && c [ j ] != ' ) ' ) { len ++ ; j ++ ; } if ( len > 0 ) wip ++ ; if ( c [ j ] == ' _ ' ) j ++ ; } j ++ ; i = j ; } else if ( c [ i ] != ' _ ' ) { j = i + 1 ; while ( j < n && c [ j ] != ' _ ' && c [ j ] != ' ( ' && c [ j ] != ' ) ' ) { j ++ ; } max = Math . max ( max , j - i ) ; i = j ; } else i ++ ; } System . out . println ( max + " ▁ " + wip ) ; sc . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) body: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) body: (block (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (expression_statement (update_expression (identifier)))))) (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) body: (block (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (identifier)))) alternative: (expression_statement (update_expression (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))