use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my $n = <STDIN>);
chomp (my @a = split / /, <STDIN>);
sub bitset {
  my $x = sprintf "%060b", shift;
  return $x;
}
my (@b, @c);
for my $i (0..($n-1)) {
  $b[$i] = [split(//, bitset($a[$i]))];
  for my $j (0..59) {
    $c[$j] += $b[$i][$j];
  }
}
say @c;
@c = map {($n-$_)*$_} @c;
say @c;
my $ans = 0;
for my $i (0..60) {
  $ans += 2 ** (59-$i) * $c[$i];
  $ans %= 1e9+7;
}
say $ans;