Algorithms and Data Structures

• Status
• 1
Implementation
• 2
Bitwise operations
• 3
Prefix Sums
• 4
Sliding window / Two pointers
• 5
Modular Arithmetic
• 6
Number Theory
• 7
Binary Search
• 8
Basic Sorting
• 9
Greedy Algorithms
• 10
Basic Dynamic Programming
• 11
Recursion
• 12
• 13
Queue & Stack
• 14
Binary tree + BST
• 15
Divide & Conquer + Advanced Sorting
• 16
Heap
• 17
Hashing
• 18
Graph Representation
• 19
BFS

• # Negation and complement of a number

When working with binary numbers it’s sometimes necessary to flip the bits (turn all the 1s to 0s and all the 0s to 1s). This is called computing the complement or the negation of a number.
Given an integer `n`, you are asked to calculate its negation (flip the bits).

#### Input

The input contains a single integer `n` (1 ≤ n ≤ ).

#### Output

The program should print the binary negation of `n`. The negation should start from `0` (the leftmost `1` in the binary representation of `n`).

#### Examples

 Input Output 6 001 311 011001000

#### Explanation

• 6: 110 ⇒ negation will be 001
• 311: 100110111 ⇒ negation will be 011001000

#### Constraints

Time limit: 1 seconds

Memory limit: 512 MB

Output limit: 1 MB