#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int n;
int bits[100][2];
int cont = 0;
long long ans = 0LL;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    cont = 0;
    while (x) {
      long long y = x & 1LL;
      (bits[cont][y])++;
      x = x >> 1;
      cont++;
    }
  }
  for (int i = 0; i < 64; i++) {
    bits[i][0] = n - bits[i][1];
    ans = (ans + ((bits[i][0] * bits[i][1] * (1LL << i)) % 1000000007LL)) %
          1000000007LL;
  }
  cout << ans << "\n";
  return 0;
}
