#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
vector<int> nums(64);
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  ll a[n + 1];
  for (int i = 0; i < (n); i++) cin >> a[i];
  for (int j = 0; j < (64); j++)
    for (int i = 0; i < (n); i++) {
      if (a[i] >> j & 1) nums[j]++;
    }
  ll ans = 0;
  ll keta = 1;
  for (int i = 0; i < (64); i++) {
    ll res = nums[i] * (n - nums[i]);
    res %= mod;
    res = (res * keta) % mod;
    keta *= 2;
    keta %= mod;
    ans = (ans + res) % mod;
  }
  cout << ans << endl;
  return 0;
}
