#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long XOR(vector<long long> &v, int n) {
  long long ans = 0;
  long long zero, one, shift = 1;
  for (int i = 0; i < 60; i++, shift = (shift << 1) % MOD) {
    one = 0, zero = 0;
    for (int j = 0; j < n; j++) {
      if (v[j] & shift)
        one++;
      else
        zero++;
    }
    ans = (ans + (((zero * one) % MOD) * (shift) % MOD) % MOD) % MOD;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  long long ans = XOR(v, n);
  cout << ans << endl;
}
