#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  long long N;
  cin >> N;
  vector<long long> bits(61, 0);
  for (long long i = 0; i < N; i++) {
    long long a;
    cin >> a;
    long long sft = 0;
    while (a > 0) {
      if (a % 2) {
        bits[sft]++;
      }
      a /= 2;
      sft++;
    }
  }
  long long ans = 0, ad = 1;
  for (long long b : bits) {
    ans += (ad * b * (N - b)) % MOD;
    ans %= MOD;
    ad *= 2;
  }
  cout << ans << endl;
}
