#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
ll ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
template <typename T>
T lcm(T x, T y) {
  T z = __gcd(x, y);
  return x * y / z;
}
template <typename T>
bool primejudge(T n) {
  if (n < 2)
    return false;
  else if (n == 2)
    return true;
  else if (n % 2 == 0)
    return false;
  double sqrtn = sqrt(n);
  for (T i = 3; i < sqrtn + 1; i++) {
    if (n % i == 0) {
      return false;
    }
    i++;
  }
  return true;
}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % 1000000007ll;
    a = a * a % 1000000007ll;
    n >>= 1;
  }
  return res;
}
int main() {
  cout << fixed << setprecision(30);
  ll n;
  cin >> n;
  vec a0(60, 0), a1(60, 0);
  for (ll i = 0; i < n; i++) {
    ll A;
    cin >> A;
    for (ll j = 0; j < 60; j++) {
      ll mod2 = A % 2;
      if (mod2 == 0)
        a0[j]++;
      else
        a1[j]++;
      A /= 2;
    }
  }
  ll ans = 0;
  for (ll j = 0; j < 60; j++) {
    ans += modpow(2, j) * a0[j] * a1[j];
    ans %= 1000000007ll;
  }
  cout << ans << endl;
  return 0;
}
