instruction: how many patients are diagnosed with icd9 code v1582 and suggested the main drug type?
response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "V1582" AND prescriptions.drug_type = "MAIN"