#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int main() {
    uint32_t n;
    scanf("%"PRIu32, &n);

    int count[60] = { 0 };
    for (uint32_t i = 0; i < n; ++i) {
        uint64_t a;
        scanf("%"PRIu64, &a);
        for (int j = 0; j < 60; ++j, a >>= 1)
            count[j] += a & 1;
    }

    uint64_t ret = 0;
    for (int i = 0; i < 60; ++i)
        ret += (count[i] * (n - count[i])) * (1LL << i);

    printf("%"PRIu64"\n", ret % 1000000007);
}
