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