import unittest


class TestD(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think([1, 2, 3]), 6)

    def test_2(self):
        self.assertEqual(think([3, 1, 4, 1, 5, 9, 2, 6, 5, 3]), 237)

    def test_3(self):
        self.assertEqual(think([3, 14, 159, 2653, 58979, 323846, 2643383, 27950288, 419716939, 9375105820]), 103715602)


def solve():
    a = read()
    result = think(a)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return read_type(int, n)


def read_float(n):
    return read_type(float, n)


def read_type(t, n):
    return list(map(lambda x: t(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    mode = 10 ** 9 + 7
    result = 0
    # TODO: avoid from TLE
    for i in range(len(data)):
        for j in range(i + 1, len(data)):
            result += data[i] ^ data[j]
            result %= mode
    return result


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()