#include <bits/stdc++.h>
using namespace std;

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!
template <int M>
struct ModInt {
    ll num;
    ModInt(): num(0LL){ }
    ModInt(ll num): num(num%M) { }
    operator int () const { return num; }
    template <class T> ModInt operator + (T n) const { auto ret = num + n; return ret >= M ? ret - M : ret; }
    template <class T> ModInt operator - (T n) const { auto ret = num - n; return ret < 0 ? ret + M : ret; }
    template <class T> ModInt operator * (T n) const { return (ll)num * n % M; }
    template <class T> ModInt operator / (T n) const { return (ll)num * modInv(ModInt(n)) % M; }
    template <class T> ModInt operator >> (T n) const { return num >> n; }
    template <class T> ModInt operator << (T n) const { return ((ll)num << n) % M; }
    template <class T> ModInt operator | (T n) const { return num | n; }
    template <class T> ModInt operator & (T n) const { return num & n; }
    template <class T> bool operator < (T n) const { return num < n; }
    template <class T> bool operator > (T n) const { return num > n; }
    template <class T> bool operator <= (T n) const { return num <= n; }
    template <class T> bool operator >= (T n) const { return num >= n; }
    template <class T> bool operator == (T n) const { return num == n; }
    template <class T> bool operator != (T n) const { return num != n; }
    ModInt operator ++ (int){ ll ret = num; num = num == M + 1 ? 0 : num + 1; return ret; }
    ModInt operator -- (int){ ll ret = num; num = num == 0 ? M - 1 : num - 1; return ret; }
    ModInt operator ++ (){ return num = num == M + 1 ? 0 : num + 1; }
    ModInt operator -- (){ return num = num == 0 ? M - 1 : num - 1; }
    constexpr ModInt &operator += (ModInt n){ num += n.num; num = num >= M ? num - M : num; return (*this); }
    //template <class T> ModInt operator += (T n){ num += n; return num = num >= M ? num - M : num; }
    template <class T> ModInt operator -= (T n){ num -= n; return num = num < 0 ? num + M : num; }
    template <class T> ModInt operator *= (T n){ return num = (ll)num * n % M; }
    template <class T> ModInt operator /= (T n){ return num = (ll)num * modInv(n) % M; }
    template <class T> ModInt operator >>= (T n){ return num = num >> n; }
    template <class T> ModInt operator <<= (T n){ return num = ((ll)num << n) % M; }
    friend ModInt modPow(ModInt base, ModInt ex) {
        ModInt ret = 1;
        while(ex.num){
            if(ex.num & 1){ ret = ret * base; }
            ex >>= 1;
            base = base * base;
        }
        return ret;
    }
    static vector<ModInt> mFacts, mInvFacts;
    friend ModInt modFact(ModInt n){ return mFacts[n.num]; }        // 階乗: n! 
    friend ModInt modInvFact(ModInt n){ return mInvFacts[n.num]; }  // 階乗分の1: 1/n!
    friend ModInt modInv(ModInt n){ return modPow(n, M - 2); }      // 1/n
    friend ModInt modC(ModInt n, ModInt k){ return modFact(n) * modInvFact(k) * modInvFact(n - k); }  // nCk
    static void init(int n){
        mFacts.resize(n + 1);
        mInvFacts.resize(n + 1);
        mFacts[0] = 1;
        for(int i = 1; i <= n; i++){
            mFacts[i] = mFacts[i - 1] * i;
        }
        mInvFacts[n] = modInv(mFacts[n]);
        for(int i = n - 1; i >= 0; i--){
            mInvFacts[i] = mInvFacts[i + 1] * (i + 1);
        }
    }
    friend istream& operator >> (istream& in, ModInt& e){ return in >> e.num; }
    friend ostream& operator << (ostream& out, const ModInt& e) { return out << e.num; }
};

template <int M>
vector<ModInt<M>> ModInt<M>::mFacts;
template <int M>
vector<ModInt<M>> ModInt<M>::mInvFacts;
// using mint = ModInt<998244353>;
using mint = ModInt<1000000007>;

//

void solve(long long N, std::vector<long long> A) {
  mint ret = 0;
  for(int i=0; i<62; ++i){
    ll n0 = 0; ll n1 = 0;
    for(int j=0;j<N;++j){
      if((A[j] >> i) & 1LL) n1++;
      else n0++;
    }
    //ret = ret + mint(1LL<<i) * n0 * n1;
    ret += mint(1LL<<i) * n0 * n1;
  }
  cout << ret << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


Measured memory_bytes: 5644