#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
#include<assert.h>

typedef long long ll;
typedef unsigned long long ll;

int main()
{
    int n;
    ll* a;
    ll sum = 0;
    scanf("%d", &n);
    a = calloc(n, sizeof(ll));
    for (size_t i = 0; i < n; i++)
    {
        scanf("%lld", a + i);
    }

    for (size_t i = 0; i < n - 1; i++)
    {
        for (size_t j = i + 1; j < n; j++)
        {
            sum += (a[i] ^ a[j]);
            sum %= 1000000007LL;
        }
    }

    printf("%lld", sum);

    return 0;
}

