#include <bits/stdc++.h>
using namespace std;
using Int = long long;
using ii = pair<Int, Int>;
template <class T>
inline bool chmax(T& a, const T& b) {
  if (a >= b) return false;
  a = b;
  return true;
}
template <class T>
inline bool chmin(T& a, const T& b) {
  if (a <= b) return false;
  a = b;
  return true;
}
struct in {
  int n;
  in() {}
  in(int n_) : n(n_){};
  template <class T>
  operator T() {
    T ret;
    cin >> ret;
    return ret;
  }
  template <class T>
  operator vector<T>() {
    vector<T> ret(n);
    for (int i = 0; i < n; i++) cin >> ret[i];
    return ret;
  }
};
struct SetupIO {
  SetupIO() {
    cin.tie(nullptr), ios::sync_with_stdio(false),
        cout << fixed << setprecision(20);
  }
} setup_io;
template <class T>
T pow(T x, int n, const T UNION = 1) {
  T ret = UNION;
  while (n) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
}
template <int MD>
struct ModInt {
  int x;
  static unordered_map<int, int> to_inv;
  ModInt() : x(0) {}
  ModInt(long long x_) {
    if ((x = x_ % MD + MD) >= MD) x -= MD;
  }
  ModInt& operator+=(ModInt that) {
    if ((x += that.x) >= MD) x -= MD;
    return *this;
  }
  ModInt& operator*=(ModInt that) {
    x = (unsigned long long)x * that.x % MD;
    return *this;
  }
  ModInt& operator-=(ModInt that) {
    if ((x -= that.x) < 0) x += MD;
    return *this;
  }
  ModInt& operator/=(ModInt that) {
    x = (unsigned long long)x * that.inv().x % MD;
    return *this;
  }
  ModInt operator-() const { return -x < 0 ? MD - x : -x; }
  ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
  ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
  ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
  ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
  bool operator==(ModInt that) const { return x == that.x; }
  bool operator!=(ModInt that) const { return x != that.x; }
  ModInt inv() const {
    return to_inv.count(this->x) ? to_inv[this->x]
                                 : (to_inv[this->x] = pow(*this, MD - 2).x);
  }
  friend ostream& operator<<(ostream& s, ModInt<MD> a) {
    s << a.x;
    return s;
  }
  friend istream& operator>>(istream& s, ModInt<MD>& a) {
    long long tmp;
    s >> tmp;
    a = ModInt<MD>(tmp);
    return s;
  }
  friend string to_string(ModInt<MD> a) { return to_string(a.x); }
};
template <int MD>
unordered_map<int, int> ModInt<MD>::to_inv;
using mint = ModInt<1000000007>;
vector<mint> fact, fact_inv;
void init_factorial(int n) {
  fact = vector<mint>(n + 1, 1);
  fact_inv = vector<mint>(n + 1);
  for (int i = 0; i < n; i++) fact[i + 1] = fact[i] * (i + 1);
  fact_inv[n] = mint(1) / fact[n];
  for (int i = n - 1; i >= 0; i--) fact_inv[i] = fact_inv[i + 1] * (i + 1);
}
mint comb(int n, int r) { return fact[n] * fact_inv[r] * fact_inv[n - r]; }
const int K = 61;
signed main() {
  Int n = in();
  vector<Int> a = in(n);
  vector<Int> num(K);
  for (Int i = 0, max_i = (n); i < max_i; i++) {
    for (Int k = 0, max_i = (K); k < max_i; k++) {
      num[k] += a[i] >> k & 1;
    }
  }
  mint ans = 0;
  for (Int k = 0, max_i = (K); k < max_i; k++) {
    ans += (num[k] * (n - num[k])) << k;
  }
  cout << ans << endl;
}
