Algorithm


A. Flea travel
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You should answer: will the flea visit all the hassocks or not. We assume that flea has infinitely much time for this jumping.

Input

The only line contains single integer: 1 ≤ n ≤ 1000 — number of hassocks.

Output

Output "YES" if all the hassocks will be visited and "NO" otherwise.

Examples
input
Copy
1
output
Copy
YES
input
Copy
3
output
Copy
NO



 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming

#include <cstdio>
#include <vector>

int main(){

    int n; scanf("%d\n", &n);
    std::vector<int> present(n, 0); present[0] = 1;

    int pos(0);
    for(int p = 1; p <= 2 * n; p++){pos += p; pos %= n; present[pos] = 1;}

    bool possible(1);
    for(int p = 0; p < n; p++){if(present[p] == 0){possible = 0; break;}}
    puts(possible ? "YES" : "NO");

    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
1

Output

x
+
cmd
YES
Advertisements

Demonstration


Codeforces Solution-A. Flea travel-Solution in C, C++, Java, Python

Previous
Codeforces solution 1080-B-B. Margarite and the best present codeforces solution
Next
CodeChef solution DETSCORE - Determine the Score CodeChef solution C,C+