#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>

#define for0(i, N)    for (int i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (int i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (int i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (int i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (int i = (x), a = 0; a < (N);  \
                              i = (i + 1) % (N), ++a)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;

long long constexpr mod = 1000000007LL;

class llm{
    long long l;
    static std::unordered_map<long long, llm> inv;

public:
    llm(long long m = 0LL) : l((m % mod >= 0)?(m % mod):(m % mod + mod)) {};

    llm inverse() const {
        if(inv.find(l) == inv.end()){
            llm x = pow(mod - 2);
            inv.emplace(l, x);
            return x;
        }
        return inv[l];
    }

    llm pow(long long i) const {
        if (i < 0)  return inverse().pow(i);
        return pow(i, 1, l);
    }

    static llm pow (long long a, long long i, long long base = 1) {
        if (i == 0) return base;
        return pow( a * a % mod, i >> 1, base * ((i & 1) == 0 ? 1 : a) % mod);
    }

    llm operator= (llm m) {l = m.l; return *this;}

    llm operator<< (long long i) const {return pow( i);};
    llm operator>> (long long i) const {return pow(-i);}

    llm operator+ (llm m)       const {return llm(l + m.l);}
    llm operator+ (int m)       const {return llm(l + (m % mod));}
    llm operator+ (long m)      const {return llm(l + (m % mod));}
    llm operator+ (long long m) const {return llm(l + (m % mod));}

    llm operator- (llm m)       const {return llm(l - m.l);}
    llm operator- (int m)       const {return llm(l - (m % mod));}
    llm operator- (long m)      const {return llm(l - (m % mod));}
    llm operator- (long long m) const {return llm(l - (m % mod));}

    llm operator* (llm m)       const {return llm(l * m.l);}
    llm operator* (int m)       const {return llm(l * (m % mod));}
    llm operator* (long m)      const {return llm(l * (m % mod));}
    llm operator* (long long m) const {return llm(l * (m % mod));}

    llm operator/ (llm m)       const {return llm((*this) * m.inverse() % mod);}
    llm operator/ (int m)       const {return llm(l * llm(m).inverse()) % mod;}
    llm operator/ (long m)      const {return llm(l * llm(m).inverse()) % mod;}
    llm operator/ (long long m) const {return llm(l * llm(m).inverse()) % mod;}

    llm operator++ (void) {return l = (l + 1) % mod;}
    llm operator++ (int)  {long long tmp = l; ++(*this); return tmp;}

    long long operator-- (void) {return l = (l - 1) % mod;}
    long long operator-- (int)  {long long tmp = l; --(*this); return tmp;}

    llm operator+ (void) const {return llm( l);}
    llm operator- (void) const {return llm(-l);}

    template<typename T> llm operator+= (T m) {return *this = *this + m;}
    template<typename T> llm operator-= (T m) {return *this = *this - m;}
    template<typename T> llm operator*= (T m) {return *this = *this * m;}
    template<typename T> llm operator/= (T m) {return *this = *this / m;}

    operator long long() {return l;}

    friend std::istream &operator>>(std::istream &stream, llm &m);

};

std::unordered_map<long long, llm> llm::inv;

std::istream& operator>> (std::istream &stream, llm &m) {
    long long tmp;
    stream >> tmp;
    m.l = tmp % mod;
    return stream;
}


int main(void){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n;
    cin >> n;

    vector<ll> a(n);

    vector<ll> c1(60, 0);

    for0(i, n){
        cin >> a[i];
        ll z = a[i];

        for0(j, 60){
            if(z & 1){
                ++c1[j];
            }
            z >>= 1;
        }
    }


    ll result = 0;
    ll now = 1;

    for (ll i = 0; i < 60; ++i) {
        result = c1[i]%mod * (n - c1[i])%mod * now%mod + result;
      result %= mod;
        now = 2*now%mod;
    }

    cout << result;


    return 0;
}


Measured memory_bytes: 2560