using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Math.Pow(10, 9) + 7;
            //var aaa = Math.Pow(2, 60) % (Math.Pow(10, 9) + 7);
            var N = int.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split().Select(ulong.Parse).ToArray();
            double result = 0;

            for (int i = 0; i < array.Length - 1; i++)
            {
                for (int j = i + 1; j < array.Length; j++)
                {
                    var xor = array[i] ^ array[j];

                    result = (result + xor) % a;
                }
            }

            Console.WriteLine(result);
        }

    }
}
