#include <bits/stdc++.h>
using namespace std;
bool flagdebug = false;
int main() {
  flagdebug = true;
  const int64_t BITS = 63;
  const int64_t MOD = 1000000007;
  int64_t n;
  cin >> n;
  vector<uint64_t> a(n);
  vector<uint64_t> b0(BITS, 0);
  vector<uint64_t> b1(BITS, 0);
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    for (int j = 0; j < (int)(BITS); j++) {
      if (a[i] & ((uint64_t)1 << j)) {
        b1[j]++;
      } else {
        b0[j]++;
      }
    }
  }
  uint64_t ans = 0;
  for (int j = 0; j < (int)(BITS); j++) {
    ans += ((uint64_t)1 << j) * (b0[j] * b1[j] % MOD);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
