import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


class Solver(object):
    def __init__(self):
        pass

    def solve(self, N, A_l):
        ans = 0
        for i in range(N-1):
            for j in range(i+1, N):
                ans += A_l[i] ^ A_l[j]
        return ans % (10**9 + 7)


def main():
    N = int(input())
    A_l = [int(i) for i in input().split()]
    solver = Solver()
    print(solver.solve(N, A_l))


if __name__ == "__main__":
    main()
