#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 58;
struct Edge {
  long long s, t, d;
};
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
signed main() {
  long long N;
  cin >> N;
  long long ar[60] = {0};
  long long tmp;
  for (long long i = 0; i < N; i++) {
    cin >> tmp;
    for (long long j = 0; j < 60; j++) {
      if (tmp & (1ll << j)) {
        ar[j]++;
      }
    }
  }
  long long ans = 0;
  long long mod = 1000000007;
  for (long long i = 0; i < 60; i++) {
    ans = ans + ((1ll << i) % mod) * ar[i] * (N - ar[i]);
    ans = ans % mod;
  }
  cout << ans << endl;
  return 0;
}
