#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
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;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  long long ma = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    chmax(ma, a[i]);
  }
  int k = 0;
  while (ma > 0) {
    ma = ma >> 1;
    k++;
  }
  long long ans = 0;
  for (int i = 0; i < k; i++) {
    long long n0 = 0, n1 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & ((long long)1 << i))
        n1++;
      else
        n0++;
    }
    long long tmp = (long long)pow(2, i);
    tmp %= mod;
    tmp *= n0 * n1;
    tmp %= mod;
    ans += tmp;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
