using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            long[] e = new long[N];
            string[] s = Console.ReadLine().Split(' ');
            for (int i = 0; i < N; i++)
            {
                e[i] = long.Parse(s[i]);
            }

            long ans = 0;
            for (int i = 0; i < N - 1; i++)
            {
                for (int j = i + 1; j < N; j++)
                {
                    ans += e[i] ^ e[j];
                    ans %= 1000000007;
                }
            }

            Console.WriteLine(ans);
        }
    }
}

