#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  ll ans;
  for (int i = 0; i < (int)(60); i++) {
    int x = 0;
    for (int j = 0; j < (int)(n); j++)
      if (a[j] >> i & 1) x++;
    ll now = x * (n - x);
    for (int j = 0; j < (int)(i); j++) {
      now *= 2;
      now %= MOD;
    }
    ans += now;
    ans %= MOD;
  }
  cout << ans << endl;
}
