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