The present invention relates to serotonin 5-HT6 receptor antagonists - novel substituted 3-sulfonyl-6,7,8,9-tetrahydropyrazolo[1,5-a]pyrido[4,3-e]pyrimidines and substituted 3-sulfonyl-5,6,7,8-tetrahydropyrazolo[1,5-a]pyrido[4,3-d]pyrimidines, drug substances and pharmaceutical compositions comprising drug substances as the mentioned above compounds and to the method of prophylaxis and treatment of various conditions and diseases of central nervous system in humans and warm-blooded animals pathogenesis of which is associated with serotonin 5-HT6 receptors.In formulas 1 and 2Ar represents optionally substituted aryl or optionally substituted heterocyclyl R1 represents hydrogen, optionally substituted lower C1-C3 alkyl, substituted hydroxyl group, substituted sulfahyl group R2 represents hydrogen or optionally substituted C1-C3 alkyl R3 represents hydrogen, optionally substituted C1-C3 alkyl or tert.-butyloxycarbonyl.