#include <bits/stdc++.h>
using namespace std;
using vll = vector<long long>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using pii = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
long long llpow(long long x, T n) {
  long long ans = 1;
  if (x == 0) ans = 0;
  while (n) {
    if (n & 1) ans *= x;
    x *= x;
    n >>= 1;
  }
  return ans;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
template <class T>
inline T gcd(T x, T y) {
  if (y == 0)
    return x;
  else {
    return gcd(y, x % y);
  }
}
template <class T>
inline T lcm(T x, T y) {
  return x / gcd(x, y) * y;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long INF = 1LL << 60;
int main() {
  long long n;
  cin >> n;
  vll a(n);
  for (long long i = (long long)0; i < (long long)n; i++) cin >> a[i];
  long long mod = 1e9 + 7;
  long long res = 0;
  vector<vll> d(60, vll(2, 0));
  for (long long i = (long long)0; i < (long long)60; i++) {
    long long cmp = 1LL << i;
    bool check = false;
    for (long long j = (long long)0; j < (long long)n; j++) {
      if (cmp <= a[j]) check = true;
      long long src = 0;
      if (cmp & a[j]) {
        src = 1;
      }
      d[i][src]++;
    }
    if (!check) break;
  }
  for (long long i = (long long)0; i < (long long)60; i++) {
    res += (long long)d[i][0] * d[i][1] * (1LL << i);
    res %= mod;
    if (res < 0) res += mod;
  }
  cout << res << endl;
  return 0;
}
