import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	try {
    		final int N = sc.nextInt();
    		long [] A = new long[N];
    		for (int i=0; i<N; i++) {
    			A[i] = sc.nextLong();
    		}

    		long sum = 0;
    		for (int i=0; i<N-1; i++) {
    			for (int j=i+1; j<N; j++) {
    				long tmp = A[i] ^ A[j];
    				sum += tmp;
    				sum = sum % 1000000007;
    			}
    		}

    		System.out.println(sum);

    	} finally {
    		sc.close();
    	}
    }
}
