#include <bits/stdc++.h>
using namespace std;
using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
void initvv(vector<vector<T>> &v, int a, int b, const T &t = T()) {
  v.assign(a, vector<T>(b, t));
}
template <class T>
T gcd(T &a, T &b) {
  if (a < b) {
    swap(a, b);
  }
  T r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};
ll pow2(int n) {
  ll ans = 1;
  for (int i = 0; i < n; i++) {
    ans = (ans * 2) % 1000000007;
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  42;
  int n, m;
  cin >> n;
  vector<ll> a(n);
  vint b(61);
  for (int i = 0; i < n; i++) {
    ll c;
    cin >> c;
    int cou = 0;
    while (c > 0) {
      if ((c & 1) == 1) {
        b[cou]++;
      }
      cou++;
      c >>= 1;
    }
  }
  ll ans = 0;
  for (int i = 0; i < 61; i++) {
    ans = (ans + ((b[i] * (n - b[i])) % 1000000007) * pow2(i)) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
