#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, A[400000], cnt0, cnt1, ans = 0, Amax = 0;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    Amax = max(Amax, A[i]);
  }
  for (int i = 0; i <= log2(Amax); ++i) {
    cnt0 = 0;
    cnt1 = 0;
    for (int j = 0; j < N; ++j) {
      if (A[j] & (1 << i)) {
        ++cnt1;
      } else {
        ++cnt0;
      }
    }
    ans += (cnt0 * cnt1) << i;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
