#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int N;
ll a[300002];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }
  ll res = 0;
  for (int i = 0; i < 64; ++i) {
    ll zeros = 0;
    ll ones = 0;
    for (int j = 0; j < N; ++j) {
      if (a[j] % 2 == 0) {
        ++zeros;
      } else {
        ++ones;
      }
      a[j] >>= 1;
    }
    ll cur = ((1ll << i) * zeros * ones);
    res += cur;
    res %= mod;
  }
  cout << res << '\n';
}
