import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }

void main() {
  auto N = readln.chomp.to!int;
  auto A = readln.split.to!(long[]);

  void solve() {
    long[bool][] count;
    foreach(bit; 0..60) {
      auto c = [false: 0L, true: 0L];
      ulong bt = 1 << bit;
      foreach(a; A) {
        c[((a >> bit) & 1) == 1]++;
      }
      count ~= c;
    }

    long sum;
    foreach(i, c; count) {
      auto keisu = c[true] * c[false];
      sum += (1L << i) * c[true] * c[false] % 1000000007;
      sum %= 1000000007;
    }
    writeln(sum);
  }

  solve();
}
