The present invention relates to compounds of formula (I) and pharmaceutically acceptable salts thereof:n n n Formula In n n n n n n n Wheren n n A, G, r, and R 1 to R 5 are as defined in the specification and claims.n n n Such compounds are useful for the treatment and / or prevention of diseases associated with the modulation of H3 receptors.