Provided is a novel compound having an HER2 inhibitory action and a suppressive effect on cell proliferation. Also provided is a pharmaceutical useful in diseases involving HER2, especially in the prevention and/or treatment of cancer, on the basis of the HER2 inhibitory action. A compound represented by formula (I) [in the formula, X, Y, Z1, Z2, Z3, Z4, W, n, R1, R2, and R3 have meanings as defined in the specification] or a salt thereof.