#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;
}
ll solve(ll N, vector<ll> A) {
  ll ans = 0;
  vector<ll> d(60), z(60);
  for (ll i = 0; i < (N); ++i) {
    ll x = pow(2, 59);
    for (ll j = 0; j < (60); ++j) {
      if (A[i] / x != 0)
        d[j]++, A[i] -= x;
      else
        z[j]++;
      x /= 2;
    }
  }
  ll x = pow(2, 59);
  for (ll i = 0; i < (60); ++i) {
    ll xx = (d[i] * z[i]) % MOD;
    ans += (xx * 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;
}
