Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.
Hint
Use the remainder operator. Careful: in some languages -3 % 2 is -1.