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

const MOD = 10^^9 + 7;

long calc(long[] a) {
    long[61] zero, one;
    foreach (e; a) {
        for (int i = 0; i <= 60; i++) {
            if (e & (1L << i)) one[i]++;
            else zero[i]++;
        }
    }

    long ans = 0;
    for (int i = 0; i <= 60; i++) {
        // 0 と 1 のペア数
        long cnt = zero[i] * one[i] % MOD;
        ans += ((1L << i) % MOD) * cnt % MOD;
        ans %= MOD;
    }
    return ans;
}

void main() {
    read;
    auto a = reads!long;
    writeln(calc(a));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;
