#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
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;
  }
};
ll dbit(ll N, ll d) {
  N = N >> d;
  return N & 1;
}
long pow_mod(long a, long n, long mod) {
  long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = (res * a) % mod;
    }
    a = (a * a) % mod;
    n = (n >> 1);
  }
  return res;
}
long kai_mod(long a, long mod) {
  long res = 1;
  for (long i = 1; i <= a; i++) res = (res * i) % mod;
  return res;
}
int main() {
  ll N;
  cin >> N;
  ll bit[60][2] = {0};
  for (ll i = 0; i < N; i++) {
    ll a;
    cin >> a;
    for (ll i = 0; i < 60; i++) {
      bit[i][dbit(a, i)]++;
    }
  }
  mint res = 0;
  for (ll i = 0; i < 60; i++) {
    ll zero_num = bit[i][0];
    ll one_num = bit[i][1];
    res += pow_mod(2, i, mod) * zero_num * one_num;
  }
  cout << res << endl;
}
