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


public class A
{
    static long mod = 1000000007;
    static long sumXOR(long[] arr, int n)
    {
        long sum = 0;
        for (int i = 0; i < 64; i++)
        {
            // Count of zeros and ones 
            long zc = 0, oc = 0;

            // Individual sum at each bit position 
            long idsum = 0;

            for (int j = 0; j < n; j++)
            {
                if (arr[j] % 2 == 0)
                    zc++;

                else
                    oc++;
                arr[j] /= 2;
            }

            // calculating individual bit sum  
            idsum = oc * zc * (((long)1 << i) % mod);

            // final sum  
            sum = (sum + idsum) % mod;
        }
        return sum;
    }
    public static void Main(string[] args)
    {
        int t = 1;
        while (t > 0)
        {
            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Trim().Split().Select(x => long.Parse(x)).ToArray();
            
            
            Console.WriteLine(sumXOR(arr,n));
            t--;
        }
    }
}