using System;

class Program
{
    static void Main(string[] args)
    {
        string strN = Console.ReadLine();
        long N = Int32.Parse(strN);

        string strArray = Console.ReadLine();
        string[] a_array = strArray.Split(' ');

        long[] ai_array = new long[N];

        for (long i = 0; i < N ; i++)
        {
            ai_array[i] = Int64.Parse(a_array[i]);
        }

        long sum = 0;
        for (long i = 0; i < N - 1; i++ )
        {
            for(long j = i + 1; j < N; j++ )
            {
               long xor = ai_array[i] ^ ai_array[j];

                sum += xor;
            }
        }

        long amari = sum % 1000000007;
        Console.WriteLine(sum.ToString());
    }
}