#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template <class T>
constexpr int sz(const T& a) {
  return (int)a.size();
}
template <class T>
constexpr T pow2(const T a) {
  return a * a;
}
template <class T, class... Args>
constexpr T mins(T& a, Args... args) {
  return a = min<T>({a, args...});
}
template <class T, class... Args>
constexpr T maxs(T& a, Args... args) {
  return a = max<T>({a, args...});
}
template <class T>
struct ModInt {
  T x;
  ModInt(T x = 0) : x(x % mod) {}
  ModInt& operator+=(const ModInt a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  ModInt& operator-=(const ModInt a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  ModInt& operator*=(const ModInt a) {
    (x *= a.x) %= mod;
    return *this;
  }
  ModInt operator+(const ModInt a) const {
    ModInt res(*this);
    return res += a;
  }
  ModInt operator-(const ModInt a) const {
    ModInt res(*this);
    return res -= a;
  }
  ModInt operator*(const ModInt a) const {
    ModInt res(*this);
    return res *= a;
  }
  ModInt pow(T t) const {
    if (!t) return 1;
    ModInt a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  ModInt inv() const { return pow(mod - 2); }
  ModInt& operator/=(const ModInt a) { return (*this) *= a.inv(); }
  ModInt operator/(const ModInt a) const {
    ModInt res(*this);
    return res /= a;
  }
};
using mint = ModInt<long long>;
int n;
ll a[300005];
void solve() {
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  mint ans = 0;
  for (int i = 0; i < (int)(62); ++i) {
    ll s = 0, t = 0;
    for (int j = 0; j < (int)(n); ++j)
      if (((a[j] >> i) & 1) == 1)
        ++s;
      else
        ++t;
    ans += (s * t) << i;
  }
  cout << ans.x << endn;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  solve();
  cout << flush;
  return 0;
}
