#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<ll, ll>;
using Graph = vector<vector<Edge>>;
struct aaa {
  aaa() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
string BASE_CONVERSION(ll num, ll base, ll digit) {
  string s = "";
  ll x = pow(base, digit - 1);
  for (ll i = 0; i < digit; i++) s += to_string(num / x), num %= x, x /= base;
  return s;
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll solve(ll N, vector<ll> A) {
  ll ans = 0;
  vector<ll> d(60), z(60);
  COMinit();
  for (ll i = 0; i < (N); ++i) {
    string x = BASE_CONVERSION(A[i], 2, 60);
    for (ll j = 0; j < (60); ++j) {
      if (x[j] == '1')
        d[j]++;
      else
        z[j]++;
    }
  }
  ll x = pow(2, 59);
  for (ll i = 0; i < (60); ++i) {
    ans += (d[i] * z[i] * x) % MOD;
    x /= 2;
    ans %= MOD;
  }
  return ans;
}
int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < (N); ++i) cin >> A[i];
  cout << (solve(N, A)) << '\n';
  return 0;
}
