The present invention relates to novel compounds of the formula I which are inhibitors of phosphodiesterase type 10A and to their use for the manufacture of a medicament and which thus are suitable for treating or controlling of medical disorders selected from neurological disorders and psychiatric disorders, for ameliorating the symptoms associated with such disorders and for reducing the risk of such disorders. wherein Q is O or S, X1 is N or CH, X2 is N or C-R7; X3 is O, S-X4=C(R8)-, where C(R8) is bound to the carbon atom which carries R2, or -X5=C(R9)-, where X5 is bound to the carbon atom which carries R2; X4 is N or C-R9; X5 is N; Het is selected from optionally substituted phenyl, monocyclic hetaryl and fused bicyclic hetaryl; R1 is selected inter alia from hydrogen, halogen, OH, C1-C4-alkyl, trimethylsilyl, C1-C4-alkylsulfanyl, C1-C4-alkoxy-C1-C4-alkyl, C1-C4-alkoxy, C1-C4-alkoxy-C1-C4-alkoxy, the moiety Y1-Cyc1; R2 is selected inter alia from hydrogen, halogen, OH, C1-C4-alkyl, trimethylsilyl, C1-C4-alkoxy-C1-C4-alkyl, C1-C4-alkoxy, C1-C4-alkoxy-C1-C4-alkoxy, C2-C4-alkenyloxy, etc; A represents one of the following groups A1, A2, A3, A4 or A5: where * indicates the points of attachment to Het and to the nitrogen atom, respectively; and where R3 to R9, R3e, R3f, A', Y1 and Cyc1 are defined in the claims.