#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> D(64, 0);
  for (int i = 0; i < (int)(N); i++) {
    long long A;
    cin >> A;
    int cnt = 0;
    while (A != 0) {
      if (A & 1) D[cnt]++;
      cnt++;
      A /= 2;
    }
  }
  const int MOD = 1e9 + 7;
  long long ans = 0;
  long long k = 1;
  for (int i = 0; i < (int)(64); i++) {
    ans = (ans + (k * D[i] * (N - D[i]))) % MOD;
    k = (k * 2) % MOD;
  }
  cout << ans << endl;
}
