#include <bits/stdc++.h>
using namespace std;
using bigint = long long int;
using vi = vector<int>;
int main() {
  int N;
  cin >> N;
  bigint arr[N];
  for (int i = 0; i < N; i++) cin >> arr[i];
  bigint ans = 0;
  bigint two = 1;
  for (bigint i = 0; i < 60; i++) {
    bigint set = 0, unset = 0;
    for (int j = 0; j < N; j++) {
      if (arr[j] & (1LL << i))
        set++;
      else
        unset++;
    }
    bigint A = ((set * unset) * two) % 1000000007;
    (ans += A) %= 1000000007;
    (two *= 2) %= 1000000007;
  }
  cout << ans << "\n";
  return 0;
}
