#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<long long> bit(62);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long(i) = 0; (i) < (n); (i)++) cin >> a[i];
  for (long long(i) = 0; (i) < (n); (i)++) {
    for (long long(j) = ((62) - 1); (j) >= 0; (j)--) {
      if (a[i] & (1LL << j)) bit[j]++;
    }
  }
  long long ans = 0;
  for (long long(i) = 0; (i) < (62); (i)++) {
    ans += ((n - bit[i]) * bit[i] * ((1LL << (i)) % MOD)) % MOD;
    ans %= MOD;
  }
  cout << ans % MOD << endl;
}
