#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  sort(a.begin(), a.end(), greater<long long>());
  long long ans = 0, tmp = 1;
  int d = 0;
  while ((a.at(0) >> d) > 0) {
    long long cnt0 = 0, cnt1 = 0;
    for (int j = 0; j < n; j++) {
      if ((a.at(j) >> d) & 1)
        cnt1++;
      else
        cnt0++;
    }
    d++;
    ans += tmp * cnt1 * cnt0;
    ans %= mod;
    tmp *= 2;
    tmp %= mod;
  }
  cout << ans << endl;
}
