Double, XOR and do it again
Java 8, 68 57 53 52 bytes

n-&gt;{for(int i=0;i&lt;n;)i-=(i*2^i)==n?n=i:-1;return n;}

-5 bytes thanks to @OlivierGrégoire.
Try it online.
Explanation:
n-&gt;{                 // Method with integer as both parameter and return-type
  for(int i=0;i&lt;n;)  //  Loop `i` in the range (1,n)
    i-=(i*2^i)==n?   //   If `i*2` XOR-ed with `i` equals `n`
        n=i          //    Set `n` to `i`, and set `i` to 0 to reset the loop
       :             //   Else:
        -1;          //    Increase `i` by 1 to go to the next iteration
  return n;}         //  Return `n` after the entire loop