The present invention provides a compound represented by the formula (I): wherein each symbol is as defined in the DESCRIPTION, or a pharmaceutically acceptable salt thereof. The compound has a superior TRPA1 antagonist activity, and can provide a medicament useful for the prophylaxis or treatment of diseases involving TRPA1 antagonist and TRPA1.