#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000007;
long long int A[300005];
int N;
int C0[70], C1[70];
int main(void) {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  for (int i = 1; i <= N; i++) {
    long long int tmp = A[i];
    int cnt = 0;
    while (tmp > 0) {
      if (tmp % 2 == 1) {
        C1[cnt]++;
      } else {
        C0[cnt]++;
      }
      tmp /= 2;
      cnt++;
    }
  }
  long long int ans = 0;
  long long int P = 1;
  for (int i = 0; i < 63; i++) {
    long long int prod = ((N - C1[i]) * C1[i]) % MOD;
    ans += P * prod;
    ans %= MOD;
    P *= 2;
  }
  cout << ans << endl;
  return 0;
}
