#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    size_t N;
    uint_least64_t A;
    intmax_t num[64] = {};
    intmax_t ans = 0;

    scanf("%zu", &N);
    for (size_t i = 0; i < N; i++) {
        scanf("%"SCNuFAST64, &A);
        for (unsigned int j = 0; (1ULL << j) < (1ULL << 61); j++) {
            if (A & (1ULL << j))
                num[j]++;
        }
    }

    for (size_t i = 0; i < 64; i++) {
        ans += num[i] * (N - num[i]) * (1ULL << i);
        ans %= (int)1e9 + 7;
    }

    printf("%jd\n", ans);

    return 0;
}
