i encountered to this function

```
void reverseArray(int *a,int n)
{
for(int i=0,j=n-1;i<j;i++,j--)
{
a[i]^=a[j]^=a[i]^=a[j];
}
}

```

which is reversing a given array but I can't wrap my mind around how does this reverse an array, isn't Xor operator only returns the non-common bits.
so what's the logic behind this to reverse the given array.