#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int nmax = 300000;
const int admax = 60;
int main() {
  int n;
  cin >> n;
  int count[admax] = {};
  int md = 0;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    int d = 0;
    while (a) {
      if (a & 1) count[d]++;
      a >>= 1;
      d++;
    }
    md = max(md, d);
  }
  int ans = 0;
  for (int i = 0; i < md; i++) {
    ans = (ans + (n - count[i]) * count[i] * (1LL << i)) % mod;
  }
  cout << ans << endl;
}
