using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static long Solve(int N, long[] A)
        {
            int[] zeros = new int[60];
            int[] ones = new int[60];
            foreach (long a in A)
            {
                for (int i = 0; i < 60; ++i)
                {
                    if (((1L << i) & a) != 0) { ++ones[i]; } else { ++zeros[i]; }
                }
            }
            const int M = 1000000007;
            long ans = 0;
            for (int i = 0; i < 60; ++i)
            {
                ans += (((1L << i) % M) * ((zeros[i] * ones[i]) % M)) % M;
                ans %= M;
            }
            return ans;
        }

        static void Main(string[] args)
        {
            int N = ReadInt();
            long[] A = ReadLongs();
            Console.WriteLine(Solve(N, A));
        }
    }
}
