def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    ans = 0
    for i in range(0,60) :
        one = zer = 0
        for x in A:
            if(x&(1<<i)):
                one+=1
            else:
                zer+=1
        ans += one*zer*(1<<i)
    print(ans%1000000007)

if __name__ == '__main__':
    main()
