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

namespace No1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32( Console.ReadLine());
            string str = Console.ReadLine();
            string[] strs = str.Split(' ');
            ulong[] num = new ulong[(int)1e6];
            ulong sum = 0, tem = (Int64)1e9 + 7;
            for (var i = 0; i < strs.Length; i++)
            {
                num[i] = ulong.Parse(strs[i]);
               
            }
            ulong nums = 1;
            for (var i = 0; i < 64; i++)
            {
                int zero = 0, one = 0;
                for (var j=0;j<n;j++)
                {
                    if (num[j] % 2 == 1)
                        one++;
                    else
                        zero++;
                    num[j] = num[j] >> 1;
                }
                int b = zero * one;
                
                //Console.WriteLine(zero+" "+one+" "+nums);
                sum = (sum + ((ulong)b *nums)%tem)%tem;
                nums = (nums << 1) % tem;

            }
            Console.WriteLine(sum%tem);

        }
    }
}
