#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long bits0[65];
long long bits1[65];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  long long x;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    for (int j = 0; j < 62; ++j)
      if ((x & (1LL << j)) != 0)
        bits1[j]++;
      else
        bits0[j]++;
  }
  long long sol = 0;
  for (int i = 0; i < 62; ++i)
    sol = (sol + ((1LL << i) % MOD) * bits0[i] * bits1[i] % MOD) % MOD;
  cout << sol << '\n';
  return 0;
}
