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

namespace ClassLibrary1
{
    public class ListNode
    {
        public int val;
        public ListNode next;
        public ListNode(int x) { val = x; }
    }


    public class Class1
    {
        static Dictionary<Tuple<long, long>, long> dic = new Dictionary<Tuple<long, long>, long>();


        static void Main(string[] args)
        {

            var n = ReadLong();
            var ll = ReadLongArr();

            BitArr[] b = new BitArr[n];

            for(int i=0; i<n; i++)
            {
                b[i] = new BitArr(ll[i]);
            }

            long mod = 1000000007;
            long res = 0;
            long order = 1;
            for(int i=0; i<64; i++)
            {
                int bitcnt = 0;
                for(int j=0; j<n; j++)
                {
                    if(b[j].bitArr[i])
                    {
                        bitcnt++;
                    }
                }
                res += (n - bitcnt) * bitcnt * order;
                res = res % mod;
                order = order*2;
            }
            Console.WriteLine(res);
        }

        class BitArr
        {
            public bool[] bitArr = new bool[64];

            public BitArr(long l)
            {
                var ll = l;
                for(int i=0; i<64; i++)
                {
                    bitArr[i] = (ll % 2) == 1;
                    ll = ll / 2;
                }
            }
        }

        public static int Digit(long num)
        {
            // Mathf.Log10(0)はNegativeInfinityを返すため、別途処理する。
            return (num == 0) ? 1 : ((int)Math.Log10(num) + 1);
        }

        public static long nCm(long n, long m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            var a = n * nCm(n - 1, m - 1) / m;
            return a % 1000000007;
        }

        private static string ReadString()
        {
            return Console.ReadLine();
        }
        private static string[] ReadStringArr()
        {
            return Console.ReadLine().Split(' ');
        }
        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadLongArr()
        {
            string[] s = ReadStringArr();
            long[] l = new long[s.Length];
            for(int i=0; i<l.Length; i++)
            {
                l[i] = long.Parse(s[i]);
            }

            return l;
        }
    }

}
