using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        int N= int.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split();
        ulong []A = new ulong[N];
        for(int i = 0; i < N; i++)
        {
            A[i] = ulong.Parse(input[i]);
        }
        ulong ans = 0;
        for(int i = 0; i < N; i++)
        {
            for(int j = i+1; j < N; j++)
            {
                ans = (ans+(A[i] ^ A[j]))%1000000007;
            }
        }
        Console.WriteLine(ans);
    }
}