The present invention provides a compound represented by formula (I) below, or a pharmaceutically acceptable salt thereof, which, having histamine H3 receptor antagonist or inverse agonist activity, is useful in the prophylaxis or therapy of metabolic diseases, circulatory diseases, or nervous system diseases.[where, for example, Ar is a divalent group formed by eliminating two hydrogen atoms from benzene, X1 is a nitrogen atom, sulfur atom or oxygen atom, R1 is a 5- to 6-membered heteroaryl group, Ring A is a 5- to 6-membered heteroaryl ring, R2 and R3 are amino groups or alkylamino groups, and X2 is represented by formula (II):(where R4 and R5 are lower alkyl groups, and n is an integer from 2 to 4).]