#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
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;
}
const long long MOD = 1000000007;
void solve() {
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < (N); ++i) cin >> A[i];
  long long result = 0;
  for (int i = 0; i < 60; ++i) {
    int zero = 0;
    int one = 0;
    for (int j = 0; j < N; ++j) {
      if ((A[j] >> i) & 1LL)
        ++one;
      else
        ++zero;
    }
    result += ((one * zero) * ((1LL << i) % MOD)) % MOD;
  }
  result = result % MOD;
  cout << result << endl;
  return;
}
int main() {
  solve();
  return 0;
}
