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

namespace ConsoleApp17
{
    class Program
    {
        const long MOD = 1000000007;

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);

            var sum = 0L;
            for (int i = 0; i < n - 1; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    var x = a[i] ^ a[j];
                    sum += x;
                    sum %= MOD;
                }
            }

            Console.WriteLine(sum);
        }
    }
}
