#include <stdio.h>
#include <stdlib.h>

int main(){
    int N;
    long Sum=0;
    scanf("%d",&N);
    long *A = malloc(sizeof(long)*N);
    int i,j;
    for(i=0;i<N;i++)scanf("%ld",&A[i]);
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++) Sum+=(A[i]^A[j]);
    }
    printf("%ld\n",Sum%(1000000007));
}