#include <bits/stdc++.h>
using ll = long long;
const ll mod = 1000000007;
const ll infi = 1000000000000000;
const ll md = 998244353;
using namespace std;
using vl = vector<ll>;
using pll = pair<ll, ll>;
ll power(ll y) {
  ll res = 1;
  for (int i = 0; i < y; i++) {
    res = (res * 2) % mod;
  }
  return res;
}
void solve() {
  int n;
  ll ans = 0;
  cin >> n;
  vl a(n);
  deque<vector<int>> b(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j < n; j++) {
    for (int i = 0; i < 64; i++) {
      b[j].push_back(a[j] % 2);
      a[j] = a[j] / 2;
    }
  }
  for (int i = 0; i < 64; i++) {
    ll cnto = 0, cntz = 0;
    for (int j = 0; j < n; j++) {
      if (b[j][i] == 1) cnto++;
    }
    ans = (ans + ((cnto) * (n - cnto) * power(i))) % mod;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  solve();
  return 0;
}
