instruction: Count the number of patients admitted before the year 2177 whose lab test abnormal status is delta.
response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2177" AND lab.flag = "delta"