using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace PaizaTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            long dividedNum = (long)Math.Pow(10, 9) + 7;

            var oneLine = Console.ReadLine().Split(' ').Select(long.Parse).ToList();
            long sum = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    sum += oneLine[i] ^ oneLine[j];
                }
                while (dividedNum < sum)
                {
                    sum -= dividedNum;
                }
            }

            //Debug.Assert(Math.Pow(10, 9) == (10 ^ 9));
            //Console.WriteLine(sum % ((Math.Pow(10, 9) + 7)));
            Console.WriteLine(sum);
            //Console.WriteLine(sum / Math.Pow(10, 9) + sum / 7);
        }
    }
}

