The invention provides an a,ß unsaturated amide compound having anticancer activity shown by formula (I) or a pharmaceutically acceptable salt or the like thereof: [in the formula, A represents an optionally substituted heterocyclic diyl, R1 represents a hydrogen atom or an optionally substituted lower alkyl, R2 represents an optionally substituted aryl, optionally substituted cycloalkyl, optionally substituted aliphatic heterocyclic group, or optionally substituted aromatic heterocyclic group, X represents -O-, -S-, -SO2-?-NRX1- (in the formula, RX1 represents a hydrogen atom or a lower alkyl), CHRX2- (in the formula, RX2 represents a hydrogen atom or a hydroxy), -CH=CH-, -CO-, or -NH-CO, n1 and n2 are the same or different and each represent 0 or 1].