#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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;
}
const double PI = 3.141593;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll combination(ll n, ll r) {
  if (r * 2 > n) r = n - r;
  ll dividend = 1;
  ll divisor = 1;
  for (ll i = 1; i <= r; ++i) {
    dividend *= (n - i + 1);
    divisor *= i;
  }
  return dividend / divisor;
}
ll n;
ll ans = 0;
int main() {
  cin >> n;
  ll a[n + 10];
  for (auto i = 0; i < (n); i++) cin >> a[i];
  ll p = 1;
  for (auto i = 0; i < (61); i++) {
    ll cnt = 0;
    for (auto j = 0; j < (n); j++) {
      if ((a[j] >> i) & 1) cnt++;
    }
    ans += ((n - cnt) % 1000000007 * cnt % 1000000007 * p % 1000000007);
    p *= 2;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
