using System;

class ACBC1208_D
{
    public static void Main()
    {
        var c = uint.Parse(Console.ReadLine());
        var ss = Console.ReadLine().Split(' ');
        ulong num = (ulong)Math.Pow(10, 9) + 7;
        ulong result = 0;

        for(uint i = 0;i < c - 1;i++)
            for(uint n = i + 1;n < c;n++)
                result += ulong.Parse(ss[i]) ^ ulong.Parse(ss[n]);

        if (result >= num) result %= num;
        Console.WriteLine(result);
    }
}