#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
int main() {
  int n;
  ll res = 0;
  cin >> n;
  vector<ll> v(n);
  for (ll i = 0; i < (ll)n; i++) cin >> v[i];
  vector<int> digit(60, 0);
  for (ll i = 0; i < (ll)n; i++) {
    for (int j = 0; j < 60; j++) {
      if (v[i] % 2 == 1) digit[j]++;
      v[i] /= 2;
    }
  }
  ll two = 1;
  for (int i = 0; i < 60; i++) {
    int many = (digit[i] * (n - digit[i]) * two) % 1000000007;
    res = (res + many) % 1000000007;
    two *= 2;
  }
  cout << res << endl;
  return 0;
}
