#include <bits/stdc++.h>
using namespace std;
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>;
template <class T>
pair<T, size_t> max(vector<T> &x) {
  auto it = max_element((x).begin(), (x).end());
  return make_pair(*it, it - x.begin());
}
template <class T>
pair<T, size_t> min(vector<T> &x) {
  auto it = min_element((x).begin(), (x).end());
  return make_pair(*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;
}
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
template <int M>
struct ModInt {
  ll num;
  ModInt() : num(0LL) {}
  ModInt(ll num) : num(num) {}
  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; }
  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]; }
  friend ModInt modInvFact(ModInt n) { return mInvFacts[n.num]; }
  friend ModInt modInv(ModInt n) { return modPow(n, M - 2); }
  friend ModInt modC(ModInt n, ModInt k) {
    return modFact(n) * modInvFact(k) * modInvFact(n - k);
  }
  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<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 += 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;
}
