#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long mul(int z) {
  int s = 1;
  for (int i = 0; i < z; i++) s = (s * 2) % MOD;
  return s;
}
int main() {
  int n;
  cin >> n;
  int sum = 0;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < 60; i++) {
    int odd = 0, even = 0;
    for (int j = 0; j < n; j++) {
      if (v[j] % 2)
        odd++;
      else
        even++;
      v[j] /= 2;
    }
    sum = (sum + mul(i) * (odd * even) % MOD) % MOD;
  }
  cout << sum << endl;
  return 0;
}
