using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var Ai = Sarray();
            var ans = 0L;
            var mask = 1L;
            for (var i = 0; i < 60; ++i, mask <<= 1)
            {
                var one = 0L;
                var zero = 0L;
                foreach(var a in Ai)
                {
                    if (0 == (mask & a))
                        ++zero;
                    else
                        ++one;
                }
                ans = (ans + ((mask % Mod) * (one * zero) % Mod) % Mod) % Mod;
            }
            WriteLine(ans);
            Out.Flush();
        }
    }
}