#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL MOD = 1e9 + 7;
void Main() {
  const int MAX_DIGIT = 60;
  int n;
  cin >> n;
  LL dig[MAX_DIGIT] = {};
  for (int i = (0); i < (int)n; ++i) {
    LL a;
    cin >> a;
    for (int d = (0); d < (int)MAX_DIGIT; ++d) {
      dig[d] += a & 1;
      a >>= 1;
    }
  }
  LL ans = 0;
  for (int i = (0); i < (int)MAX_DIGIT; ++i) {
    ans += (1LL << i) % MOD * dig[i] % MOD * (n - dig[i]) % MOD;
  }
  cout << ans << endl;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
