def main():
    from math import log2,ceil
    from collections import defaultdict
    import sys
    input=sys.stdin.readline
    n=int(input())
    a=tuple(map(int,input().split()))
    mod=10**9+7
    cnt=defaultdict(lambda :0)

    for temp in a:
        if temp==0:continue
        digit=len(bin(temp))-2
        for j in range(ceil(digit)+1):
            if (temp>>j)&1:
                cnt[j]=cnt[j]+1

    #print(cnt)
    ans=0
    for digit,count in cnt.items():
        ans=(ans+pow(2,digit)*count*(n-count))%mod
    print(ans)

if __name__=='__main__':
    main()