using System;
using System.Linq;

class Program
{
	static void Main(string[] args)
	{
        //メモリが足りない
		// 入力
        var n = int.Parse(Console.ReadLine());
		string[] input = Console.ReadLine().Split(' ');
        ulong x = Convert.ToUInt64(Math.Pow(10, 9)+7);

        //数値に変換
        ulong[] tmp = new ulong[n];
        for (int i = 0; i < n; i++)
        {
            tmp[i] = ulong.Parse(input[i]);
        }

        //XOR(排他的論理和)を取得
        ulong[,] b = new ulong[n,n];
        for (int i = 0; i < n; i++)
        {
            for (int k = i+1; k < n; k++)
            {
                b[i,k] = tmp[i] ^ tmp[k];
            }
        }

        ulong count = 0;
        for (int i = 0; i < n; i++)
        {
            for (int k = 0; k < n; k++)
            {
                count += b[i,k];
            }
            
        }

        //出力
        Console.WriteLine(count%x);
	}
}