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

int main() {
    uint32_t n;
    scanf("%"PRIu32, &n);
    uint64_t a[n];
    for (uint32_t i = 0; i < n; ++i)scanf("%"PRIu64, &a[i]);

    uint64_t sum = 0;
    for (uint32_t i = 0; i < n; ++i)
        for (uint32_t j = i + 1; j < n; ++j)
            sum += (a[i] ^ a[j]);

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