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 m = 1;
	long ans;
	A: while(1){
		long x;
		foreach(a; as) if(a % 2 > 0) x += 1;
		x *= (n - x), x %= mod;
		x *= m, x %= mod;
		ans += x, ans %= mod;

		m *= 2;
		foreach(ref a; as) a /= 2;
		foreach(a; as) if(a > 0) continue A;
		break;
	}
	ans.writeln;
}
