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 divisor = (ulong)Math.Pow(10, 9) + 7; 
		ulong result = 0;

		for(int i = 0; i < numbers.Length - 1; i++) {
			for(int j = i + 1; j < numbers.Length; j++) {
				ulong value = numbers[i] ^ numbers[j];
				if(result > ulong.MaxValue - value) {
					result %= divisor;
				}
				result += value;
			}
		}
 
		Console.WriteLine(result % divisor);
	}
}
