#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
const ll infll = 1ll * 1ll << 30 * 1ll << 30;
const long double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll max(ll a, ll b) { return (a > b ? a : b); }
ll min(ll a, ll b) { return (a > b ? b : a); }
ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); }
ll gcd(ll a, ll b, ll& x, ll& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  ll x1, y1;
  ll d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
ll modinv(ll a, ll b) {
  ll x, y;
  gcd(a, b, x, y);
  return (x % b + b) % b;
}
ll bpow(ll a, ll b, ll m) {
  a %= m;
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % m;
    b >>= 1;
    a = a * a % m;
  }
  return res;
}
vector<vector<ll> > mat_mul(vector<vector<ll> > mat1, vector<vector<ll> > mat2,
                            ll mod1) {
  vector<vector<ll> > res(ll((mat1).size()),
                          vector<ll>(ll((mat2[0]).size()), 0));
  for (ll i = 0; i <= ll((mat1).size()) - 1; i++) {
    for (ll j = 0; j <= ll((mat2[0]).size()) - 1; j++) {
      for (ll k = 0; k <= ll((mat1[0]).size()) - 1; k++) {
        res[i][j] = (res[i][j] + (mat1[i][k] * mat2[k][j]) % mod1) % mod1;
      }
    }
  }
  return res;
}
vector<vector<ll> > mat_exp(vector<vector<ll> > mat, ll p, ll mod1) {
  vector<vector<ll> > res(ll((mat).size()), vector<ll>(ll((mat[0]).size()), 0));
  for (ll i = 0; i <= ll((mat).size()) - 1; i++) res[i][i] = 1;
  while (p > 0) {
    if (p & 1) res = mat_mul(res, mat, mod1);
    mat = mat_mul(mat, mat, mod1);
    p >>= 1;
  }
  return res;
}
const int N = 3 * 100000 + 5;
ll n, m, t, q, g, k, x, y, u, z, w, ans;
ll a[N];
ll one[64], zero[64];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (ll i = 1; i <= n; i++) cin >> a[i];
  for (ll i = 1; i <= n; i++) {
    for (ll j = 0; j <= 63; j++) (a[i] & (1LL << j)) ? one[j]++ : zero[j]++;
  }
  for (ll i = 0; i <= 33; i++)
    x += ((one[i] * zero[i]) % 1000000007) * ((1LL << i) % 1000000007),
        x = x % 1000000007;
  cout << x << '\n';
}
