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

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();

			long[] b = new long[61];
			for (int i = 0; i < n; i++) {
				long x = a[i];
				int j = 0;
				while (x > 0) {
					if (x % 2 == 1) {
						b[j]++;
					}
					x /= 2;
					j++;
				}
			}
			//System.Diagnostics.Debug.WriteLine(string.Join(" ", b));
			long ans = 0;
			for (int i = 0; i < b.Length; i++) {
				ans += b[i] * (n - b[i]) * ((1L << i) % mod);
				ans %= mod;
				//System.Diagnostics.Debug.WriteLine($"{b[i]} * {n - b[i]} * {1L << i:x} % mod");
			}
			Console.WriteLine(ans);


			Console.Out.Flush();
		}
	}
}
