using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;

class Program
{
    static void Main(string[] args)
    {
        //入力を受け取る
        var N = long.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        
        var sum = 0L;
        for(int i = 0;i < N-1;i++){
          for(int j = i+1;j < N;j++){
            sum += (A[i]^A[j])%1000000007;
            sum %= 1000000007;
          }
        }
      
        Console.WriteLine(sum);
        
    }
}
