#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;
}
template <class long long>
inline long long udfPow(long long a, int b) {
  long long ans = 1;
  for (long long i = 0; i < b; i++) {
    ans = (ans * a) % 1000000007;
  }
  return ans;
}
int main() {
  int N;
  vector<long long> A;
  int cnt[63];
  memset(cnt, 0x00, 63 * sizeof(int));
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long long temp = 0;
    cin >> temp;
    for (long long ii = 0; ii < 63; ii++) {
      if (temp & 1) {
        cnt[ii]++;
      }
      temp = temp >> 1;
      if (temp == 0) {
        break;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 63; i++) {
    long long cnt2 = cnt[i] * (N - cnt[i]) % 1000000007;
    if (cnt2 == 0) continue;
    long long temp2 = udfPow(2, i);
    ans += ((temp2 * cnt2) % 1000000007);
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
