[Object] An excellent agent for preventing or treating dementia, schizophrenia, and the like, based on serotonin 5-HT5A receptor modulating action, is provided.[Means for Solution] It was confirmed that acylguanidine derivatives (the following formula I any one of Z1, Z2, Z3, Z4 and Z5 is nitrogen atom, and the others are carbon atoms) which have the characteristic structure in which the guanidine is bonded to one ring of the quinoline or isoquinoline via a carbonyl group, and a cyclic group is bonded to the other ring, exhibit potent 5-HT5A receptor modulating actions and excellent pharmacological actions based on the 5-HT5A receptor modulating action, and thus can be excellent agents for preventing or treating dementia, schizophrenia, bipolar disorder, or attention deficit hyperactivity disorder. Thus, the present invention has been completed.