#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int M = 1e9 + 7;
ll mul(ll a, ll b) { return a * b % M; }
int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  vector<ll> arr(N);
  for (auto& v : arr) {
    cin >> v;
  }
  ll res = 0;
  for (int b = 0; b < 63; b++) {
    ll v = 1LL << b;
    ll n = 0;
    for (int i = 0; i < N; i++) {
      if (arr[i] & v) {
        n++;
      }
    }
    res += mul(mul(n, N - n), v);
    res %= M;
  }
  cout << res << endl;
  return 0;
}
