
def main():
    N = int(input())
    a_list = list(map(int, input().split()))
    mod = 10 ** 9 + 7

    sum = 0

    for i in range(60):
        count_1 = 0
        for a in a_list:
            try:
                if format(a, "b")[59-i] == "1":
                    count_1 += 1
            except:
                pass

        sum += 2 ** i * count_1 * (N - count_1)

    print(sum % mod)


if __name__ == '__main__':
    main()