#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vl>;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll mod(ll a) { return (a % 1000000007); }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
int main() {
  ll n;
  cin >> n;
  vl bit1(62);
  vl bit0(62);
  for (int i = 0; i < (n); i++) {
    ll x;
    cin >> x;
    for (ll j = 0; j < 62; j++) {
      if (x >= pow(2, j)) {
        if (x & (1 << j)) {
          bit1[j]++;
        } else {
          bit0[j]++;
        }
      } else {
        bit0[j]++;
      }
    }
  }
  ll sum = 0;
  for (int i = 0; i < (62); i++) {
    if (i <= 40) {
      sum += bit1[i] * bit0[i] * mod(ll(pow(2, i)));
    } else
      sum += bit1[i] * bit0[i] * mod(ll(pow(2, 40))) * mod(ll(pow(2, i - 40)));
    sum = mod(sum);
  }
  cout << sum << endl;
}
