#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long cnt[60];
  fill(cnt, cnt + 60, 0);
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    for (int j = 0; j < 60; j++) {
      if (a & (1ll << j)) cnt[j]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long t = cnt[i] * (n - cnt[i]) % ((long long)(1e9) + 7);
    ans += t * (1ll << i) % ((long long)(1e9) + 7);
    ans %= ((long long)(1e9) + 7);
  }
  cout << ans << endl;
  return 0;
}
