using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var ai = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            var p = (long)Math.Pow(10, 9) + 7;
            var result = 0L;
            for (var i = 0; i < ai.Length - 1; i++)
            {
                for (var j = i + 1; j < ai.Length; j++)
                {
                    result += (ai[i] ^ ai[j]) % p;
                }
            }
            Console.WriteLine(result % p);
        }
    }
}
