#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chMax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chMin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int N;
  int cnt[63];
  memset(cnt, 0x00, 63 * sizeof(int));
  cin >> N;
  for (unsigned long long i = 0; i < N; i++) {
    unsigned long long temp = 0;
    cin >> temp;
    for (unsigned long long ii = 0; ii < 63; ii++) {
      if (temp & 1) {
        cnt[ii]++;
      }
      temp = temp >> 1;
      if (temp == 0) {
        break;
      }
    }
  }
  unsigned long long ans = 0;
  unsigned long long temp2 = 1;
  for (unsigned long long i = 0; i < 63; i++) {
    unsigned long long cnt2 = cnt[i] * (N - cnt[i]) % 1000000007;
    ans = (ans + ((temp2 * cnt2) % 1000000007)) % 1000000007;
    temp2 = temp2 * 2 % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
