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

typedef long long ull;
typedef unsigned long long ll;

#define mod 1000000007LL

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

    b = 1;
    for (size_t i = 0; i < 61; i++)
    {
        m = 0;
        for (size_t j = 0; j < n; j++)
        {
            m += (a[j] & b) >> i;
        }
        sum += ((n - m) * m * (b % mod)) % mod;
        sum %= mod;
        b <<= 1;
    }

    printf("%lld", sum);

    return 0;
}

