The present invention relates to compounds of formula I wherein R1 halogen, lower alkyl, lower alkoxy, cyano, phenyl, C(O)NHCH3, C(O)NH2, lower alkyl substituted by halogen or is a five-membered heteroaryl group, optionally substituted by lower alkyl; Y1 is N or CH; Y2 is CH; and if Y1 is CH, Y1 and Y2 may form together with the C-atoms to which they are attached a ring, containing -CH=N-N(CH3)-, -CH=N-N(H)-; X is CH or N; R is (CH2)m-cycloalkyl, optionally substituted by hydroxy, lower alkoxy or lower alkyl, or is tetrahydropyran, optionally substituted by hydroxy, or is lower alkoxy, substituted by hydroxy, or is lower alkyl substituted by one or two hydroxy, or is (CH2)m-pyridinyl, optionally substituted by hydroxy, lower alkyl or lower alkyl substituted by hydroxy, or is L-phenyl, optionally substituted by hydroxy, lower alkyl or lower alkyl substituted by hydroxy, and L is a bond, -CH(CH2OH)- or -CH2CH(OH)-; n is 0, 1 or 2; m is 0 or 1; or to a pharmaceutically acceptable acid addition salt, to a racemic mixture or to its corresponding enantiomer and/or optical isomers thereof. The compounds of the present invention are muscarinic M1 receptor positive allosteric modulators (PAM) and hence are useful in the treatment of diseases, mediated by the muscarinic M1 receptor, such as Alzheimer's disease, cognitive impairment, schizophrenia, pain or sleep disorders.