An institution (or a distinct part of an institution) which- (1) is primarily engaged in providing to residents- (A) skilled nursing care and related services for residents who require medical or nursing care, (B) rehabilitation services for the rehabilitation of injured, disabled, or sick persons, or, on a regular basis, health-related care and services to individuals who because of their mental or physical condition require care and services (above the level of room and board) which can be made available to them only through institutional facilities, and is not primarily for the care and treatment of mental diseases; (2) has in effect a transfer agreement with one or more hospitals.