Grains Exercise (Bitwise Approach)