using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class D
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		long[] A = GetLongs((int)N);

		long[,] c = new long[N + 1, 61];
		for(int i = 0; i < N; i++)
		{
			long rest = A[i];
			for(int j = 0; j <= 60; j++)
			{
				c[i + 1, j] = c[i, j];
				if(rest % 2 == 1)
					c[i + 1, j]++;

				rest >>= 1;
			}
		}

		var P = new ModInt(0);
		var pow = new ModInt[61];
		for(int i = 0; i <= 60; i++)
			pow[i] = new ModInt(1 << i);

		for(int i = 0; i < N - 1; i++)
		{
			for(int j = 0; j <= 60; j++)
			{
				if(!contains(A[i], j))
					continue;

				var cnt = new ModInt(c[N, j] - c[i + 1, j]);
				P += cnt * pow[j];
			}
		}
		P *= 2;

		var Q = new ModInt(0);
		for(int i = 0; i < N; i++)
			Q += new ModInt(A[i]) * (N - 1);

		WriteLine((Q - P).Val);
	}
	
	private bool contains(long s, int x) => ((s >> x) & 1) == 1;
}

public struct ModInt
{
	public long Mod { get; private set; }
	public long Val { get; private set; }

	public ModInt(long v)
	{
		// must initialize (default: Mod = 0)
		Mod = 1000000007;
		Val = v;
	}

	public static ModInt operator+(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long tmp = x.Val + y.Val;
		if(tmp >= mod)
			tmp -= mod;
		return new ModInt(tmp);
	}


	public static ModInt operator-(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long tmp = x.Val;
		if(tmp < y.Val)
			tmp += mod;
		tmp -= y.Val;
		return new ModInt(tmp);
	}

	public static ModInt operator*(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		return new ModInt((x.Val * y.Val) % mod);
	}

	public static ModInt operator/(ModInt x, ModInt y)
	{
		long mod = x.Mod;
		long pow = mod - 2;
		long yy = y.Val;
		long inv = 1;
		while(pow > 0)
		{
			if((pow & 1) == 1)
				inv = (inv * yy) % mod;
			yy = (yy * yy) % mod;
			pow >>= 1;
		}
		return new ModInt((x.Val * inv) % mod);
	}

	public static ModInt operator+(ModInt x, long y) => x + new ModInt(y);
	public static ModInt operator-(ModInt x, long y) => x - new ModInt(y);
	public static ModInt operator*(ModInt x, long y) => x * new ModInt(y);
	public static ModInt operator/(ModInt x, long y) => x / new ModInt(y);
	public static ModInt operator++(ModInt x) => x + new ModInt(1);
	public static ModInt operator--(ModInt x) => x - new ModInt(1);
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}