using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		long[]A = new long[N];
		string[] str = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			A[i] = long.Parse(str[i]);
		}
		long[]D1 = new long[61];
		long[]D2 = new long[61];
		long mod = 1000000007;
		for(var i=0;i<N;i++){
			long a = 1;
			for(var j=0;j<=60;j++){
				if(A[i]/a%2==1){
					D1[j]++;
				} else {
					D2[j]++;
				}
				a *= 2;
			}
		}
		long a1 = 1;
		long ans = 0;
		for(var i=0;i<=60;i++){
			long b1 = D1[i]*D2[i]%mod;
			b1 = b1 * a1 % mod;
			ans = (ans + b1) % mod;
			a1 *= 2;
		}
		Console.WriteLine(ans);
	}
}