#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

using pii = pair<int64_t, int64_t>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;

constexpr int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}
// }}} End

// Mint {{{
template <int_fast64_t MOD>
class ModInt {
    int_fast64_t value;
public:
    inline ModInt(const ModInt& other) noexcept : value(other.value) {}
    inline ModInt(int_fast64_t value = 0) noexcept :
        value((value >= MOD) ? value % MOD : (value < 0) ? (value + MOD) % MOD : value) {}

    inline ModInt inv() const noexcept { return power(value, MOD - 2); }

    inline ModInt& operator+=(const ModInt& other) noexcept {
        value = (value + other.value) % MOD; return *this;
    }
    inline ModInt& operator-=(const ModInt& other) noexcept {
        value = (MOD + value - other.value) % MOD; return *this;
    }
    inline ModInt& operator*=(const ModInt& other) noexcept {
        value = (value * other.value) % MOD; return *this;
    }
    inline ModInt& operator/=(const ModInt& other) noexcept {
        value = (value * other.inv().value) % MOD; return *this;
    }

    inline ModInt operator+(const ModInt& other) noexcept { return ModInt(*this) += other; }
    inline ModInt operator-(const ModInt& other) noexcept { return ModInt(*this) -= other; }
    inline ModInt operator*(const ModInt& other) noexcept { return ModInt(*this) *= other; }
    inline ModInt operator/(const ModInt& other) noexcept { return ModInt(*this) /= other; }

    inline bool operator==(const ModInt& other) noexcept { return value == *other; }
    inline bool operator!=(const ModInt& other) noexcept { return value != *other; }

    template <class int_>
        explicit inline operator int_() const noexcept { return static_cast<int_>(value); }

    friend ostream& operator<<(ostream &os, ModInt other) noexcept {
        os << other.value; return os;
    }

    friend istream& operator>>(istream &is, ModInt& other) noexcept {
        is >> other.value; return is;
    }

    static constexpr inline ModInt power(int_fast64_t n, int_fast64_t p) noexcept {
        int_fast64_t ret = 1;
        for (; p > 0; p >>= 1) {
            if (p & 1) ret = (ret * n) % MOD;
            n = (n * n) % MOD;
        }
        return ret;
    }
};

using Mint = ModInt<int(1e9) + 7>;
// }}}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    intmax_t N; cin >> N;

    vector<intmax_t> a(N);
    for (auto &ai: a) cin >> ai;

    const int MOD = int(1e9) + 7;
    Mint sum = 0;
    for (intmax_t i = 0; i < 60; ++i) {
        intmax_t cnt = 0;
        for (size_t j = 0; j < N; ++j) {
            if ((a[j] >> i) & 1) {
                cnt++;
            }
        }
        sum += cnt * (N - cnt) % MOD * ((1LL << i) % MOD);
    }

    cout << sum << "\n";

    return 0;
}


Measured memory_bytes: 2560