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

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var A = ReadArrayLong();
            var cnt = new int[60];
            var mod = 1000000007L;
            var ans = 0L;
            for (int i = 0; i < 60; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if ((A[j] & 1L << i) == 1L << i) cnt[i]++;
                }
                ans += cnt[i] * (N - cnt[i]) % mod * ((1L << i) % mod) % mod;
            }

            Console.WriteLine(ans % mod);
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}