#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Graphi = vector<vi>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int, int>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
struct edge {
  int to;
  int weight;
  edge(int t, int w) : to(t), weight(w) {}
};
vector<ll> a;
int n;
ll culc() {
  ll ans = 0;
  ll loop = 1;
  for (int i = 0; i < 65; i++) {
    if (i != 0) {
      loop *= 2;
      loop %= 1000000007;
    }
    ll cnt_one = 0;
    ll cnt_zero = 0;
    for (int j = 0; j < n; j++) {
      if (a.at(j) % 2 == 0)
        cnt_zero++;
      else
        cnt_one++;
      a.at(j) /= 2;
    }
    ll temp = (cnt_one * cnt_zero) * loop % 1000000007;
    ans += temp;
    ans %= 1000000007;
  }
  return ans;
}
int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  cout << culc() << endl;
  return 0;
}
