Consider R(Last_name, Rank, Room_number, shift) as R(ABCD)
We can derive following FD’s by the given relation
B→ C , AB- >CD, AC → BD,AD→ BC, BD ->AC,CD→ AB
if we find closure for the above , we get CK ={ AB, AC, AD, BD, CD}
Therefore, number of Candidate keys are 5.