#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
const int mod = 1e9 + 7;
class mint {
  long long x;

 public:
  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 {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint& a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint& a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll 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 {
    mint res(*this);
    return res /= a;
  }
  friend ostream& operator<<(ostream& os, const mint& m) {
    os << m.x;
    return os;
  }
};
int main() {
  int n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < (n); i++) cin >> a[i];
  vector<ll> d(60, 0);
  mint ans = 0;
  for (int i = 0; i < (60); i++) {
    int x = 0;
    int y = 0;
    for (int j = 0; j < (n); j++) {
      if (a[j] >> i & 1)
        y++;
      else
        x++;
    }
    d[i] = x * y;
  }
  for (int i = 0; i < (60); i++) {
    mint tmp = d[i];
    for (int j = 0; j < (i); j++) {
      tmp *= 2;
    }
    ans += tmp;
  }
  cout << ans << endl;
}
