#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  int p = 1;
  for (int i = 0; i < 60; i++) {
    int res = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & 1 << i) res++;
      a[j] >> 1;
    }
    ans += ((res * (n - res)) % mod * p) % mod;
    (p *= 2) % mod;
  }
  cout << ans << endl;
}
