void main()
{
    long n = readln.chomp.to!long;
    long[] a = readln.split.to!(long[]);

    long mod = 10 ^^ 9 + 7;
    long total;
    foreach (i; 0 .. 61)
    {
        long cnt;
        foreach (j; 0 .. n)
        {
            if ((1L << i) & a[j]) ++cnt;
        }

        long mul = (1L << i) % mod;
        mul *= cnt * (n - cnt) % mod;
        total = (total + mul) % mod;
    }

    total.writeln;
}


import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;