#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LLINF = 1e18;
const long long MOD = 1e9 + 7;
template <class T>
void puts(T x) {
  std::cout << x << std::endl;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int n;
long long a[300010];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long sum = 0;
  for (int i = 0; i < 61; i++) {
    long long zc = 0, oc = 0;
    long long idsum = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % 2 == 0)
        zc++;
      else
        oc++;
      a[j] /= 2;
    }
    idsum = oc * zc * (1ll << i);
    sum += idsum;
    sum %= MOD;
  }
  cout << sum << endl;
}
