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, X