#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> A(n);
  vector<vector<int>> bts(2, vector<int>(60));
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
    for (int j = 0; j < 60; ++j) {
      ++bts[A[i] >> j & 1][j];
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 60; ++j) {
      (ans += bts[A[i] >> j & 1 ^ 1][j] * (1ll << j)) %= int(1e9 + 7);
    }
  }
  cout << ans / 2 << '\n';
}
