#include <bits/stdc++.h>
using namespace std;
bool IsOneBit(long long bits, int i) { return (bits & (1ll << i)) > 0; }
int main() {
  int N;
  const int M = 1000000007;
  cin >> N;
  vector<long long> A(N);
  long long AMax = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    AMax = max(A[i], AMax);
  }
  int digit = log2(AMax);
  long long ans = 0;
  for (int i = 0; i <= digit; i++) {
    long long zero = 0, one = 0;
    for (long long a : A) {
      if (IsOneBit(a, i))
        one++;
      else
        zero++;
    }
    long long k = (1ll << i) % M;
    k = k * one * zero % M;
    ans = (ans + k) % M;
  }
  cout << ans << endl;
}
