import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;

const long mod = 1_000_000_007;
void main(){
	int n = readln.chomp.to!int;
	long[] as = readln.chomp.split.to!(long[]);

	long ans;
	for(long m = 1; m <= 1L << 61; m <<= 1){
		long x, y;
		foreach(a; as) if(m & a) x += 1; else y += 1;
		long tmp = x * y % mod;
		tmp *= m, tmp %= mod;
		ans += tmp, ans %= mod;
	}
	ans.writeln;
}
