The present invention provides a compound or a salt thereof having a calcium-sensing receptor antagonistic activity, and being expected to be useful as an agent for preventing or treating heart failure, pulmonary hypertension, or the like. The compounds represented by formula (I) or a salt thereof has a calcium-sensing receptor antagonistic activity, and is expected to be useful as an agent for preventing or treating heart failure, pulmonary hypertension, or the like, wherein each symbol is as described in the specification.