#include <bits/stdc++.h>
using namespace std;
long long X, v[62], ans;
int i, n, j;
inline long long M(long long value) {
  if (value < 1000000007LL) return value;
  return value % 1000000007LL;
}
long long exp(int k) {
  if (!k) return 1LL;
  if (k & 1) return M(2LL * exp(k - 1));
  long long val = exp(k / 2);
  return M(val * val);
}
int main() {
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> X;
    for (j = 0; j < 62; ++j)
      if (X & (1LL << j)) ++v[j];
  }
  for (i = 0; i < 62; ++i)
    if (v[i]) {
      ans = M(ans + v[i] * (n - v[i]) * exp(i));
    }
  cout << ans;
  return 0;
}
