#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long x = 0;
  cin >> n;
  vector<int> x0(60, 0);
  vector<int> x1(60, 0);
  for (int i = 0; i < n; i++) {
    cin >> x;
    bitset<60> a(x);
    for (int j = 0; j < 60; j++) {
      if (a[j] == 0)
        x0[j] += 1;
      else
        x1[j] += 1;
    }
  }
  long long ans = 0, k = 1, MOD = 1e9 + 7;
  for (int j = 0; j < 60; j++) {
    ans += k * (x0[j] % MOD) * (x1[j] % MOD) % MOD;
    ans %= MOD;
    k *= 2;
  }
  cout << ans << endl;
}
