#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
using namespace std;
long long func(int bit, long long a) { return ((a >> bit) & 1); }
int main() {
  int n;
  cin >> n;
  long long A[n + 1];
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
  }
  long long ans = 0;
  for (int bit = 0; bit < 60; ++bit) {
    long long tmp = (1ll << bit) % MOD;
    int num_ones = 0;
    for (int i = 0; i < n; ++i) {
      num_ones += func(bit, A[i]);
    }
    long long tmp2 = 1ll * num_ones * (n - num_ones);
    ans = (ans + (tmp * tmp2) % MOD) % MOD;
  }
  cout << ans << "\n";
  return 0;
}
