#include <bits/stdc++.h>
using namespace std;
const long MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  long long mul = 1;
  for (int i = 0; i < 60; i++) {
    long long n0 = 0;
    long long n1 = 0;
    for (int j = 0; j < N; j++) {
      if (((A[j] >> i) & 1) == 1) n1++;
      if (((A[j] >> i) & 1) == 0) n0++;
    }
    ans = ans + (n1 * n0 * mul) % MOD;
    ans = ans % MOD;
    mul = mul * 2;
    mul = mul % MOD;
  }
  cout << ans << endl;
  return 0;
}
