#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmin(T &a, T b) {
  if (a > b) a = b;
}
template <typename T>
void chmax(T &a, T b) {
  if (a < b) a = b;
}
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const long long mod = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) a[i] = lin();
  int m = 61;
  vector<long long> cnt(m);
  for (int i = 0; i < n; ++i) {
    for (int b = 0; b < m; ++b) {
      if ((a[i] >> b) & 1) cnt[b]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int b = 0; b < m; ++b) {
      long long x = (1LL << b) % mod;
      if ((a[i] >> b) & 1) {
        ans = (ans + (n - cnt[b]) * x) % mod;
      } else {
        ans = (ans + cnt[b] * x) % mod;
      }
    }
  }
  cout << ans / 2 << endl;
  return 0;
}
