#include <bits/stdc++.h>
constexpr long long int INF = std::numeric_limits<long long int>::max();
constexpr long long int NINF = std::numeric_limits<long long int>::min();
constexpr long long int MOD = 1000000000 + 7;
using namespace std;
long long int cnt[64];
long long int size = 0;
void countup(long long int n) {
  for (long long int i = 0; i < 64; i++) {
    if (n & 1) {
      cnt[i]++;
    }
    n = n >> 1;
  }
  size++;
}
void solve() {
  long long int N;
  cin >> N;
  while (N--) {
    long long int a;
    cin >> a;
    countup(a);
  }
  long long int ans = 0;
  for (long long int i = 0; i < 64; i++) {
    long long int b = cnt[i] * (size - cnt[i]);
    ans = (ans + ((1 << i) * b) % MOD) % MOD;
  }
  cout << ans << endl;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
