#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long>(A);
  ;
  for (int x = 0; x < (N); x++) {
    long long aa;
    cin >> aa;
    (A).push_back(aa);
    ;
  }
  long long mask = 1;
  long long ans = 0;
  while (mask > 0) {
    long long one = 0;
    for (int y = 0; y < (N); y++) {
      if ((A[y] & mask) != 0) {
        one++;
      }
    }
    ans += (one * (N - one) * mask) % 1000000007;
    ans %= 1000000007;
    mask <<= 1;
  }
  cout << ans << endl;
  return 0;
}
