This invention provides thienopyrimidine derivatives of the formula, wherein R 1 stands for hydrogen atom, an alkyl group or the like; R 2 stands for a hydrogen atom, an alkyl or amino group or the like, R 3 stands for an alkyl, alkenyl or alkylthio group or the like or a group Y-X-; or R 2 and R 3 may together form tetramethylene group; X standing for a direct bond or linking group such as CH 2 , CH(OH), S, O, NH; Y standing for a substituted or unsubstituted aromatic carbocycylic, aromatic heterocylic, cycloalkyl or saturated heterocyclic group or the like; Z stands for S or O, and n is 0 or an integer of 1 to 4, or salts thereof, which exhibit an inhibitory effect on PDE9, and are therefore useful for prevention or treatment of overactive bladder syndrome, pollakiuria, urinary incontinence, dysuria associated with prostatic hyperplasia, urolithiasis, Alzheimer's disease, chronic obstructive pulmonary disease, myocardial infarction, thrombosis, diabetes and the like.