A compound, represented by the following formula or a medically acceptable salt thereof, having an effect of regulating the activity of an androgen receptor. In the formula, X represents S, O; Z represents (R a ) n -A-(CR 13 R 14 ) 0-1 -(CR 11 R 12 ) 0-1 -; A represents aryl, heteroaryl; R 1 represents alkyl, cycloalkyl, alkenyl, alkynyl, alkoxyalkyl, aryl, arylalkyl, heterocycle, heterocyclic alkyl; R 2 represents hydrogen, halogen, alkyl, cycloalkyl, phenyl; R3 represents hydrogen, halogen, alkyl, cycloalkyl, alkoxyalkyl, alkenyl, alkynyl, cycloalkenyl, aryl, arylalkyl, heterocycle, heterocyclic alkyl, acyl, cycloalkylcarbonyl, benzoyl, spiroalkyl, adamantyl, silyl, R 31 R 32 NCO-; R 4 and R 5 represent hydrogen, halogen, alkyl, phenyl, and cycloalkyl.