HackerRank - Cracking the Code Interview - Bit Manipulation: Lonely Integer

Here's my Java solution for HackerRank and Cracking the Code Interview's Bit Manipulation: Lonely Integer problem.

import java.io.*;  
import java.util.*;  
import java.text.*;  
import java.math.*;  
import java.util.regex.*;

public class Solution {

    public static int lonelyInteger(int[] a) {
        int i = 0;

        for (int eh : a) { 
          i = i ^ eh;
        }

        return i;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int a[] = new int[n];
        for(int a_i=0; a_i < n; a_i++){
            a[a_i] = in.nextInt();
        }
        System.out.println(lonelyInteger(a));
    }
}