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

namespace Xor_Sum_4
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Int64.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split();
            long A2 = 0;
            decimal r;

            for (Int64 i = 1; i <= N - 1; i++)
            {
                var Ai = Int64.Parse(A[i - 1]);
                for (Int64 j = i+1; j <= N; j++)
                {
                    var Aj = Int64.Parse(A[j - 1]);
                    A2 += Ai ^ Aj;
                }
            }
            Console.WriteLine(A2 % (Math.Pow(10,9)+7));
        }
    }
}
