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

namespace ABC147D
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long[] A = new long[N];
            string[] Ainput = Console.ReadLine().Split(' ');
            for(int i = 0; i < N; i++)
            {
                A[i] = long.Parse(Ainput[i]);
            }
            long[] zero = new long[60];
            long[] one = new long[60];
            for(int i = 0; i < N; i++)
            {
                string s = Convert.ToString(A[i], 2);
                int l = s.Length;
                //Console.WriteLine(s);
                for(int j = 0; j < l; j++)
                {
                    if (s[l - j - 1].ToString() == "1")
                    {
                        one[j] += 1;
                    }
                    else
                    {
                        zero[j] += 1;
                    }
                }
                if (l < 60)
                {
                    for (int j = l; j < 60; j++)
                    {
                        zero[j] += 1;
                    }
                }
            }
            long m = 1;
            long ans = 0;
            for(int i = 0; i < 60; i++)
            {
                ans += zero[i] * one[i] * m;
                ans %= 1000000007;
                m *= 2;
                m %= 1000000007;
            }
            //Console.WriteLine(string.Join("",zero));
            //Console.WriteLine(string.Join("", one));
            Console.WriteLine(ans);
        }
    }
}
