MOD = 10**9+7
n = int(input())
A = ['{:060b}'.format(a)[::-1] for a in map(int, input().split())]
c = [a.count('1') for a in zip(*A)]
print(sum(c[d]*(n-c[d])*pow(2, d, MOD) %
          MOD for d in range(60)) % MOD)