#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int inf = 1e9;
const ll linf = 1e18;
template <long long mod>
class modint {
 private:
  long long x;

 public:
  modint(long long x = 0) : x(x >= 0 ? x % mod : (x % mod) + mod) {}
  modint &operator+=(const modint rhs) {
    if ((x += rhs.x) >= mod) x -= mod;
    return *this;
  }
  modint &operator-=(const modint rhs) {
    if ((x += mod - rhs.x) >= mod) x -= mod;
    return *this;
  }
  modint &operator*=(const modint rhs) {
    (x *= rhs.x) %= mod;
    return *this;
  }
  modint &operator/=(const modint rhs) {
    *this *= rhs.inv();
    return *this;
  }
  modint operator+(const modint rhs) const { return modint(*this) += rhs; }
  modint operator-(const modint rhs) const { return modint(*this) -= rhs; }
  modint operator*(const modint rhs) const { return modint(*this) *= rhs; }
  modint operator/(const modint rhs) const { return modint(*this) /= rhs; }
  modint operator-() const { return modint(-x); }
  modint pow(long long n) const {
    modint e = *this, ret = modint(1);
    while (n) {
      if (n & 1) ret *= e;
      e *= e, n >>= 1;
    }
    return ret;
  }
  modint inv() const { return pow(mod - 2); }
  friend ostream &operator<<(ostream &os, const modint &m) {
    os << m.x;
    return os;
  }
  friend istream &operator>>(istream &is, modint &m) {
    long long in;
    is >> in;
    m = modint(in);
    return is;
  }
};
using mint = modint<1000000007>;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  mint ans = 0;
  for (int bit = 0; bit < 60; bit++) {
    ll cnt0 = 0, cnt1 = 0;
    for (int i = 0; i < n; i++) {
      ((a[i] & (1LL << bit)) ? cnt1 : cnt0)++;
    }
    ans += (mint)(((cnt0 * cnt1) % 1000000007LL) << bit);
  }
  cout << ans << endl;
  return 0;
}
