#include <bits/stdc++.h>
using namespace std;
using G = vector<vector<int>>;
using M = map<int, int>;
using P = pair<int, int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct {
  int to;
  int cost;
};
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  ll ans = 0;
  for (int i = 0; i < 60; i++) {
    int x = 0;
    for (int j = 0; j < n; j++)
      if (a[j] >> i & 1) x++;
    ll now = x * (n - x) % MOD;
    for (int j = 0; j < i; j++) now = now * 2 % MOD;
    ans += now;
    ans %= MOD;
  }
  cout << (ans) << "\n";
  return 0;
}
