import itertools
def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    ans = [int(bin(a^b), 2) for a,b in itertools.combinations(A, 2)]
    

    print(sum(ans)%(10**9 + 7))

if __name__ == '__main__':
    main()
