#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v) {
  o << "{";
  for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
  o << "}";
  return o;
}
namespace you {
std::string to_string(char val) { return std::string(1, val); }
}  // namespace you
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < int(n); i++) cin >> a[i];
  long long mod = pow(10, 9) + 7;
  long long ans = 0;
  long long twofact = 1;
  for (int i = 0; i < 60; i++) {
    int one = 0, zero = 0;
    for (int j = 0; j < n; j++) {
      if ((a[j] >> i) & 1)
        one += 1;
      else
        zero += 1;
    }
    ans += one * zero % mod * twofact % mod;
    ans %= mod;
    twofact = twofact * 2 % mod;
  }
  cout << ans << "\n";
  return 0;
}
