#include <stdio.h>
#define DIV 1000000007

int main(void) {
    long int count;
    scanf("%ld", &count);

    long long int xor = 0, num[count];
    
    for (long int i = 0; i < count; i++) {
        scanf (" %lld", &num[i]);
    }

    for (long int i = 0; i < count - 1; i++) {
        for (long int j = i + 1; j < count; j++) {
            xor += num[i] ^ num[j];
        }
    }

    printf("%lld\n", xor % DIV);

    return 0;
}