instruction: Give the number of patients whose admission location is transfer from hosp/extram that had a procedure icd9 code of 40.
response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.icd9_code = "40"