using System;
using System.Linq;

namespace ABC147D {
    class Program {
        static void Main(string[] args) {
            Console.ReadLine();
            var aArray = Console.ReadLine().Split(' ').Select(ulong.Parse).ToArray();
            ulong sum = 0;
            for (var i = 0; i < 64; i++) {
                ulong zeros = 0;
                ulong ones = 0;
                for (var index = 0; index < aArray.Length; index++) {
                    var l = aArray[index];
                    if (l % 2 == 0) zeros++;
                    else ones++;
                    aArray[index] = aArray[index] >> 1;
                }

                sum += zeros * ones * (1UL << i);
                while (sum > 1000000007) sum -= 1000000007;
            }

            Console.WriteLine(sum);
        }
    }
}