#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < (long long)(N); i++) {
    cin >> A.at(i);
  }
  long long ans = 0;
  bitset<60> bit;
  for (long long d = 0; d < (long long)(60); d++) {
    long long num0 = 0, num1 = 0;
    for (long long i = 0; i < (long long)(N); i++) {
      bit = A.at(i);
      if (bit.test(d)) {
        num1++;
      } else {
        num0++;
      }
    }
    ans += ((num0 * num1) * (((long long)1 << d) % MOD)) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
