#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return b ? gcd(b, a % b) : a;
}
unsigned long long lcm(unsigned long long a, unsigned long long b) {
  return a / gcd(a, b) * b;
}
const long long mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0, i_len = (n); i < i_len; i++) cin >> a[i];
  ll ans = 0, two = 1;
  for (int k = 0, k_len = (60); k < k_len; k++) {
    int x = 0;
    for (int i = 0, i_len = (n); i < i_len; i++)
      if (a[i] >> k & 1) ++x;
    ll now = (ll)x * (n - x) % mod * two % mod;
    ans = (ans + now) % mod;
    two *= 2;
  }
  cout << ans << endl;
  return 0;
}
