#!/usr/bin/perl

use strict;
use warnings;

my $n = <STDIN>;
my @a;
{
    my $in = <STDIN>;
    chomp $in;
    @a = split(" ", $in);
}
my $mod = 1000000007;
my $m = 60;
my @b;
for (my $i=0; $i<$m; $i++) {
    $b[$i] = 0;
}
for (my $i=0; $i<$n; $i++) {
    my $num = $a[$i];
    for (my $j=0; $j<$m; $j++) {
        $b[$j] += $num % 2;
        $num /= 2;
        if (int($num)==0) {
            last;
        }
    }
}
my $ans = 0;
for (my $i=0; $i<$m; $i++) {
    $ans += $b[$i] * ($n - $b[$i]) * 2 ** $i % $mod;
    $ans %= $mod;
}
print "$ans\n";