#include <bits/stdc++.h>
using namespace std;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (int)n; ++i) cin >> a[i];
  long long res = 0;
  long long mask = 1LL;
  for (int i = 0; i < (int)60; ++i) {
    int one = 0;
    for (int j = 0; j < (int)n; ++j)
      if (a[j] & mask) one++;
    res += (mask * one * (n - one)) % MOD;
    res %= MOD;
    mask *= 2;
  }
  cout << res << endl;
  return 0;
}
