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

public class Program
{
    static void Main()
    {
        var N = int.Parse(Console.ReadLine().Trim());

        string[] lineRecord = Console.ReadLine().Trim().Split(' ');
      
        long result = 0;
        for (int i = 0; i < N - 1; i++)
        {
            for (int j = i + 1; j < N; j++)
            {
                result += long.Parse(lineRecord[i]) ^ long.Parse(lineRecord[j]);

                if (result > 1000000007) result = result % 1000000007;
            }
        }

        Console.WriteLine(result);
    }
}