The purpose of the present invention is to provide a novel RET inhibitor and a prophylactic or therapeutic agent for diseases that can be prevented or treated with the assistance of a RET inhibition activity (e.g. malignant tumors) each of which contains as an active ingredient a compound that is not known to have a RET inhibition activity so far or a salt of the compound. A RET inhibitor containing as an active ingredient a compound represented by formula (I) wherein A R1 to R3 X and n are as defined in the description or a salt thereof.