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

namespace ABC147D
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var sum = 0L;
            for (int i = 0; i < N; i++)
            {
                for (int j = i+1; j < N; j++)
                {
                    sum += (A[i] ^ A[j]) % 1000000007;
                    sum = sum % 1000000007;
                }
                sum = sum % 1000000007;
            }
            Console.WriteLine(sum% 1000000007);
            Console.ReadLine();
        }
    }
}
