I’m getting 50% correct answer.
here is my code
import java.util.*;
public class Main {
static int bit_set[] = new int[32];
static void add_bits(int n)
{
int pos = 0;
while(n>0)
{
if((n&1) == 1)
bit_set[pos++]++;
n = n>>1;
}
}
static int set_bit(int n, int pos)
{
int mask = 1<<pos;
return mask|n;
}
public static void main(String args[]){
// Your Code Here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ans = 0;
while(n-- > 0)
add_bits(sc.nextInt());
for(int i=0; i<32; i++)
{
if(bit_set[i]%3 == 1)
ans = set_bit(ans, i);
}
System.out.println(ans);
}
}