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

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt"); return;
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static long mod = 1000000007;

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var aa = ToIntArray(input.ReadLine(), n);

        var sum = 0L;

        for(int i=0; i<64; i++) {
            var x = 0L;
            for(int j=0; j<n; j++) {
                x += (aa[j] >> i) % 2;
            }
            sum += (x * (n - x) << i);
            sum %= mod;
        }

        return sum;
    }

    static void print(long list) {
        var buil = new StringBuilder();
        for(int i=0; i<64; i++) {
            buil.Append( (list>>(63-i)) % 2 );
        }
        Debug.Write(buil);
        Debug.WriteLine("(" + list + ")");
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl =strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}
