#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  cin >> N;
  vector<long long> X(60);
  for (long long i = (long long)(0); i < (long long)(N); i++) {
    long long A;
    cin >> A;
    bitset<60> B(A);
    for (long long j = (long long)(0); j < (long long)(60); j++) {
      if (B.test(j)) X[j]++;
    }
  }
  long long ans = 0;
  long long K = 1;
  for (long long i = (long long)(0); i < (long long)(60); i++) {
    ans += K * X[i] * (N - X[i]);
    ans %= 1000000007;
    K *= 2;
  }
  cout << ans << endl;
}
