#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long res = 0;
  for (int i = 0; i < 31; i++) {
    long long cnt = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] & (1 << i)) cnt++;
    }
    res += (cnt * ((long long)N - cnt) * 2LL) % MOD;
    if (res >= MOD) res -= MOD;
  }
  cout << res << endl;
  return 0;
}
