The present invention aims to provide a novel compound having a TRPA1 antagonist activity, and a medicament containing the compound. Moreover, the present invention aims to provide a TRPA1 antagonist and a medicament useful for the prophylaxis or treatment of diseases involving TRPA1.A medicament containing a compound represented by the formula (I):wherein each symbol is as defined in the DESCRIPTION, or a pharmaceutically acceptable salt thereof, and the like.