bit manipulation

 Problem: http://codeforces.com/contest/485/problem/C