def main():
    length = int(input())
    numbers = list(map(int, input().split()))
    numbers.sort()
    max_digit = len(bin(numbers[-1])[2:])
    count = [[0, 0] for _ in range(60)]
    for n in numbers:
        bin_n = bin(n)[2:].zfill(max_digit)
        for i in range(max_digit):
            count[max_digit - i - 1][int(bin_n[i])] += 1
    answer = 0
    mod = 10 ** 9 + 7
    for i, c in enumerate(count):
        answer = (answer + c[0] * c[1] * pow(2, i)) % mod
    print(answer)


if __name__ == '__main__':
    main()

