#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  ll maxi = -1;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    chmax(maxi, a[i]);
  }
  ll times = 0;
  while (maxi > 0) {
    maxi /= 2;
    times++;
  }
  ll sum = 0;
  ll hoge[60][2];
  memset(hoge, 0, sizeof(hoge));
  for (int i = 0; i < (int)(n); i++) {
    ll t = a[i];
    int j = 0;
    while (j < times) {
      if (t & 1)
        hoge[j][1]++;
      else
        hoge[j][0]++;
      t /= 2;
      j++;
    }
  }
  ll fuga = 1;
  for (int i = 0; i < (int)(60); i++) {
    sum += fuga * (hoge[i][0] * hoge[i][1]);
    sum %= 1000000007;
    fuga *= 2;
  }
  cout << sum << endl;
  return 0;
}
