Find XOR of Numbers Twice

You are given an array nums where each integer in [1, n] appears exactly once or twice, and nums.length = 2n. Return the XOR of all numbers that appear exactly twice.

Examples
Input: [1,2,1,3]
Output: 1
Hints

Find XOR of Numbers Twice

You are given an array nums where each integer in [1, n] appears exactly once or twice, and nums.length = 2n. Return the XOR of all numbers that appear exactly twice.