#include <bits/stdc++.h>
using namespace std;
int main(void) {
  cin.sync_with_stdio(false);
  int N;
  cin >> N;
  vector<long long> As(N);
  for (int n = 0; n < (int)(N); ++n) cin >> As[n];
  long long MOD = long long(1e9) + 7;
  long long ans = 0;
  for (int idx = 0; idx < (int)(62); ++idx) {
    long long tmp = As[0] & (1LL << idx);
    long long cnt0 = !bool(tmp);
    long long cnt1 = bool(tmp);
    for (int j = (1); j < (int)(N); ++j) {
      long long tmpj = As[j] & (1LL << idx);
      if (tmpj)
        ans += cnt0 * (1LL << idx);
      else
        ans += cnt1 * (1LL << idx);
      cnt0 += !bool(tmpj);
      cnt1 += bool(tmpj);
    }
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
