def main():
    n = int(input())
    a = list(map(int,input().split()))
    g = []
    ans = 0
    for j in range(60):
        d = 0
        for i in range(n):
            d += a[i]&1
            a[i] >>= 1
        g.append(d)
    for i in range(60):
        ans += g[i]*(n-g[i])*(pow(2,i,1000000007))
        ans = ans % (1000000007)
    print(ans%(1000000007))
if __name__ == '__main__':
    main()