Getting Wrong answer in POWERUP spoj "http://www.spoj.com/problems/POWERUP/"

My code is http://ideone.com/UzuqBL but i am continously getting wrong answer please help me to find out where i am doing wrong or missing some corner case.

check testcase :

0 0 0 ans=1

0 1 1 ans=0
.

check the testcase:
0 0 0, ans = 0, (0^0^0 = 0^1 = 1)

Corrected still getting wrong answer http://ideone.com/aK6mE6

Corrected still getting wrong answer http://ideone.com/aK6mE6

//