flags |= (1 << i);
The bitwise OR in |= will "add" bits to your bitset flags, whereas the bitwise AND can only remove bits.
You have mixed up | and &. Your expected result corresponds to the iteration of:
Contact to your favourite celebrities now like Shahnaz Gill, Mayur Verma, Shahbaz Badisha and many more.