import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
    std.typecons, std.math, std.container, std.format;

void main(string[] args)
{
    const MOD = cast(ulong)(1e9 + 7);
    long n = readln.strip.to!long;
    auto as = readln.split.to!(long[]);

    long ans = 0;
    foreach (i; 0 .. 60)
    {
        ulong[] cnt = [0, 0];
        foreach (j; 0 .. n)
        {
            cnt[(as[j] >> i) & 1]++;
        }

        ans = (ans + (cnt[0] * cnt[1] * powmod(2uL, cast(ulong) i, MOD)) % MOD) % MOD;
    }
    writeln(ans);
}
