using System;
using System.Security.Cryptography;

namespace D
{
    class Program
    {
        static public readonly int Mod = 1000000007;
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long[] A = new long[n+1];
            string[] In = Console.ReadLine().Split(' ');
            for(int i=0; i < n; i++)
            {
                A[i+1] = long.Parse(In[i]);
            }
            long sum = 0;
            for(int i = 1; i <= n - 1; i++)
            {
                for(int j=i+1; j <= n; j++)
                {
                    long temp = A[i] ^ A[j];
                    sum +=(temp % Mod);
                    sum %= Mod;
                }
            }
            Console.WriteLine(sum);
        }
    }
}
