#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

template <uint_fast64_t MOD> class ModInt {
    using u64 = uint_fast64_t;

  public:
    u64 a;

    constexpr ModInt(const u64 x = 0) noexcept : a(x % MOD) {}
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    constexpr ModInt operator+(const ModInt rhs) const noexcept {
        return ModInt(*this) += rhs;
    }
    constexpr ModInt operator-(const ModInt rhs) const noexcept {
        return ModInt(*this) -= rhs;
    }
    constexpr ModInt operator*(const ModInt rhs) const noexcept {
        return ModInt(*this) *= rhs;
    }
    constexpr ModInt operator/(const ModInt rhs) const noexcept {
        return ModInt(*this) /= rhs;
    }
    constexpr ModInt &operator+=(const ModInt rhs) noexcept {
        a += rhs.a;
        if(a >= MOD) {
            a -= MOD;
        }
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt rhs) noexcept {
        if(a < rhs.a) {
            a += MOD;
        }
        a -= rhs.a;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt rhs) noexcept {
        a = a * rhs.a % MOD;
        return *this;
    }
    constexpr ModInt &operator/=(ModInt rhs) noexcept {
        u64 exp = MOD - 2;
        while(exp) {
            if(exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
    constexpr bool operator==(const ModInt rhs) noexcept {
        return this->a == rhs.a;
    }
    constexpr bool operator!=(const ModInt rhs) noexcept {
        return this->a != rhs.a;
    }
    friend constexpr ostream &operator<<(ostream &os,
                                         const ModInt<MOD> &x) noexcept {
        return os << x.a;
    }
    friend constexpr istream &operator>>(istream &is, ModInt<MOD> &x) noexcept {
        return is >> x.a;
    }
};

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if(b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x); // 再帰的に解く
    y -= a / b * x;
    return d;
}

// 負の数にも対応した mod (a = -11 とかでも OK)
inline long long mod(long long a, long long m) { return (a % m + m) % m; }

// 逆元計算 (ここでは a と m が互いに素であることが必要)
long long modinv(long long a, long long m) {
    long long x, y;
    extGCD(a, m, x, y);
    return mod(x, m); // 気持ち的には x % m だが、x が負かもしれないので
}

int main() {
    int N;
    cin >> N;
    using mint = ModInt<MOD>;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    vector<int> sum(63);
    mint res = 0;
    rep(i, 63) {
        mint cnt0 = 0, cnt1 = 0;
        rep(j, N) {
            if(A[j] & (1LL << i)) {
                cnt1 += 1;
            } else {
                cnt0 += 1;
            }
        }
        mint tmp = 0;
        rep(j, N) {
            if(A[j] & (1LL << i)) {
                tmp = (tmp + (cnt0 * mint(1LL << i)));
            } else {
                tmp = (tmp + (cnt1 * mint(1LL << i)));
            }
        }
        res = res + (tmp / 2);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2560