using System;
using System.Linq;
 
public class Program {
	public static void Main() {
		Console.ReadLine();
 
		var numbers = Console.ReadLine().Split(' ')
			.Select(x => ulong.Parse(x))
			.ToArray();
 
		ulong sum = 0;
		for(int i = 0; i < numbers.Length - 1; i++) {
			for(int j = i + 1; j < numbers.Length; j++) {
				sum += numbers[i] ^ numbers[j];
				sum %= ((ulong)Math.Pow(10, 9) + 7);
			}
		}
 
		Console.WriteLine(sum);
	}
}
