Just in case you don't know, the mod operator means "take the remainder when I divide two numbers"

When n=1, the remainder when 1 is divided by 2 is 1.

When n=2, the remainder when 2 is divided by 2 is 0.

When n=3, the remainder when 3 is divided by 2 is 1.

When n=4, the remainder when 4 is divided by 2 is 0.

...