# coding: utf-8
from sys import stdin


def main():
    # コンソール入力を受け取る
    N = int(stdin.readline().rstrip())
    l = stdin.readline().rstrip().split()

    sum = 0
    for i in range(len(l) - 1):
        for j in range(i+1, len(l)):
            tmp = (int(l[i]) ^ int(l[j]))
            sum += tmp
    print(sum % (10 ** 9 + 7))


if __name__ == '__main__':
    main()
