#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  long maxA = 0;
  vector<long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    maxA = max(maxA, A[i]);
  }
  vector<int> count0(128, 0);
  vector<int> count1(128, 0);
  for (int i = 0; i < N; i++) {
    long tmp = A[i];
    for (int j = 0; j < 128; j++) {
      if (tmp % 2 == 0)
        count0[j]++;
      else
        count1[j]++;
      tmp /= 2;
    }
  }
  long deg = 1, ans = 0;
  for (int i = 0; i < 128; i++) {
    ans += (count0[i] * count1[i] * deg) % 1000000007;
    deg *= 2;
  }
  cout << ans % 1000000007;
}
