#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (auto& e : a) cin >> e;
  int cnt[60] = {};
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 60; ++j)
      if (a[i] & (1LL << j)) cnt[j]++;
  long long mul = 1, ans = 0;
  for (int i = 0; i < 60; ++i) {
    (ans += (((n - cnt[i]) * cnt[i]) * mul)) %= MOD;
    (mul *= 2) %= MOD;
  }
  cout << ans << endl;
  return 0;
}
