/*
 _____ ____ _____   ___   ___   ___   ___ 
|_   _/ __ \_   _| |__ \ / _ \ |__ \ / _ \
  | || |  | || |      ) | | | |   ) | | | |
  | || |  | || |     / /| | | |  / /| | | |
 _| || |__| || |_   / /_| |_| | / /_| |_| |
|_____\____/_____| |____|\___/ |____|\___/ 
*/
#include <bits/stdc++.h>
#include <fstream>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (a); i > (b); i--)
#define a(x) (x.begin(), x.end())
#define ar(x) (x.rbegin(), x.rend())
#define pb push_back
#define Pb() pop_back()
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf prllf
#define ms(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define db double
#define EPS 10E-10
#define ff first
#define ss second
#define sqr(x) (x) * (x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define DBG pf("HI\n")
#define MOD 1000000007
#define CIN                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define RUN_CASE(t, T) for (__typeof(t) t = 1; t <= T; t++)
#define CASE(t) prllf("Case %d: ", t)
#define CASEL(t) prllf("Case %d:\n", t)
#define intlimit 2147483647
#define longlimit 9223372036854775807
#define infinity (1 << 28)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 2 * acos(0.0)
using namespace std;
ll pow1(ll x,ll y){
    ll zg = x;
    y--;
    while(y>-1){
        zg*=x;
        y--;
    }
    return zg;
}
int main()
{
    CIN;
    /*    int n;
    cin >> n;
    vector<vector<pair<int, int>>> v(n);
    rep(i, 0, n)
    {
        int s;
        cin >> s;
        v[i].resize(s);
        rep(j, 0, s)
        {
            cin >> v[i][j].ff >> v[i][j].ss;
            v[i][j].ff--;
        }
    }
    int maxi = 0;
    rep(i, 1, 1 << n)
    {
        int sum = 0;
        vector<int> klo(n, -1);
        rep(k, 0, n)
        {
            if (i & (1 << k))
            {
                sum++;
                if(klo[k]==0){
                    sum = -1000000000;
                    break;
                }
                rep(j, 0, v[k].size())
                {
                    if (klo[v[k][j].ff] == -1 || klo[v[k][j].ff] == v[k][j].ss)
                        klo[v[k][j].ff] = v[k][j].ss;
                    else
                    {
                        sum = -1000000000;
                        break;
                    }
                }
            }else{
                if(klo[k]==1){
                    sum = -1000000000;
                    break;
                }
                rep(j, 0, v[k].size())
                {
                    if (klo[v[k][j].ff] == v[k][j].ss){
                        sum = -1000000000;
                        break;
                    }else{
                        klo[v[k][j].ff] = 1-v[k][j].ss;
                    }
                }
            }
        }
        maxi = max(maxi,sum);
    }
    cout << maxi;
    */
    int n;
    cin >> n;
    vl mdry(61, 0);
    rep(i, 0, n)
    {
        ll g;
        cin >> g;
        ll tbn = pow1(2,60);
        per(j, 60, -1)
        {
            tbn/=2;
            if (g >= tbn)
            {
                g -= tbn;
                mdry[j]++;
            }
        }
    }
    ll sum = 0;
    rep(i, 0, 61)
    {
        if(mdry[i])
        {
            ll temp = (n - mdry[i]) * mdry[i];
            sum += (pow1(2,i)/2%MOD) * (temp%MOD);
            sum %= MOD;
        }
    }
    cout << sum;
}
// Abcd1234?

Measured memory_bytes: 256