All problems

Problem 868

Nim Game

Easy · 10 pts · Math, Game Theory

Problem

There is a heap of N stones. You and a friend take turns, and you go first. On each turn a player removes 1, 2 or 3 stones, and whoever removes the last stone wins. Both players play perfectly. Decide whether you win. If N is a multiple of 4, whatever you take, your friend can take enough to make the total for the round 4, keeping you on multiples of 4 until you lose; otherwise you can move to a multiple of 4 yourself.

Input

A single integer N.

Output

Print YES if you win, otherwise NO.

Constraints

1 <= N <= 2^31 - 1

Example input

4

Example output

NO

Explanation

With 4 stones, taking 1, 2 or 3 leaves 3, 2 or 1 stones, and your friend takes them all. So you lose and the answer is NO.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Numbers With Repeated Digits Next: Maximum Number of Removable Characters