#include <bits/stdc++.h>
using namespace std;
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;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> A(N);
  long long ma = 0;
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
    chmax(ma, A[i]);
  }
  sort((A).rbegin(), (A).rend());
  long long sum1[80] = {0};
  long long sum0[80] = {0};
  long long ans = 0;
  for (long long j = 0; j < N; j++) {
    long long a = A[j];
    long long i = 0;
    while (i <= 60) {
      if (a % 2 == 0) {
        ans += (1LL << i) * sum1[i];
        ans %= 1000000007;
      } else {
        ans += (1LL << i) * sum0[i];
        ans %= 1000000007;
      }
      if ((1LL << i) <= ma) {
        if (a % 2) {
          sum1[i]++;
        } else {
          sum0[i]++;
        }
      }
      a /= 2;
      i++;
    }
  }
  cout << ans << endl;
  return 0;
}
