#include <bits/stdc++.h>
using namespace std;
int c[60];
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < (N); ++i) cin >> a[i];
  for (int k = 0; k < (60); ++k)
    for (int i = 0; i < (N); ++i) c[k] += (a[i] >> k) & 1;
  long long ans = 0;
  long long b = 1;
  for (int k = 0; k < (60); ++k) {
    ans += ((c[k] * (N - c[k])) % 1000000007 * b) % 1000000007;
    ans %= 1000000007;
    b = (b * 2) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
