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


public class A
{
  
    public static void Main(string[] args)
    {
        int t = 1;
        long mod = 1000000007;
        while (t > 0)
        {
            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Trim().Split().Select(x => long.Parse(x)).ToArray();
            
            var prefixSum = new long[n];
            prefixSum[0] = arr[0];
            for(int i = 1; i < n; i++)
            {
                prefixSum[i] = prefixSum[i - 1] + arr[i];
            }
            long ans = 0;
            for(int i = 0; i < n - 1; i++)
            {
                for(int j = i + 1; j < n; j++)
                {
                    ans = (ans + (arr[i] ^ arr[j])) % mod;
                }
            }
            //for(int i = 0; i < n - 1; i++)
            //{
            //    ans = ans + (arr[i] ^ (prefixSum[n - 1] - prefixSum[i]));
            //}
            Console.WriteLine(ans);
            t--;
        }
    }
}