#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
  return a = (a > b) ? b : a;
}
long long const INF = 1LL << 60;
long long const MOD = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ;
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < (N); i++) cin >> A[i];
  mint ans = 0;
  for (long long d = 0; d < (60); d++) {
    long long even = 0, odd = 0;
    for (long long i = 0; i < (N); i++) {
      if (A[i] & (1LL << d)) {
        odd++;
      } else {
        even++;
      }
    }
    mint now = odd * even * (1LL << d);
    ans += now;
  }
  cout << ans << endl;
  return 0;
}
