Get ans Set Bit

In Given video bhaiya has taken input for n=5 and for i=2 ans is 1 and for i=1 ans is 0 and for i=4 ans is 0.
But binary no of 5 is 0101. then if we suppose counting from left or right then in both cases the ouput is not matching ??