#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t N;
  cin >> N;
  vector<int64_t> cnt(61);
  for (int i = 0; i <= 60; i++) cnt[i] = 0;
  int64_t a;
  for (int i = 0; i < N; i++) {
    cin >> a;
    for (int j = 0; j <= 60; j++) {
      if (a & (1ll << j)) {
        cnt[j]++;
      }
    }
  }
  int64_t ret = 0;
  for (int i = 0; i <= 60; i++) {
    ret += (1ll << i) * cnt[i] * (N - cnt[i]);
    ret %= MOD;
  }
  cout << ret << endl;
  return 0;
}
