[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 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 said 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.