import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

enum m = 1_000_000_007;
void main() {
  int n;
  readf (" %d", &n);
  auto a = new long[n];
  foreach (t; 0 .. n) {
    readf (" %d", &a[t]);
  }
  long res;
  foreach (k; 0 .. 60) {
    immutable mask = 1L << k;
    int t1 = a.count! (i => (i & mask) != 0).to!int;
    //0, 1
    //1, 0
    long t0 = n - t1; 
    long t = (t0 * t1) % m;
    t *= mask % m;
    res += t;
  }
  res %= m;
  writeln (res);
}

