#include <bits/stdc++.h>
using namespace std;
long long ruijo(int i) {
  long long ans = 1;
  for (int j = 0; j < i; j++) {
    ans = ans * 2 % 1000000007;
  }
  return ans;
}
int main() {
  int N;
  long long A[300000];
  int i, j;
  long long ans = 0;
  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A, A + N);
  long long temp = A[N - 1];
  int cnt = 0;
  while (temp != 0) {
    temp /= 2;
    cnt++;
  }
  for (i = 0; i < cnt; i++) {
    int sum1 = 0;
    int sum2 = 0;
    for (j = 0; j < N; j++) {
      if (A[j] % 2 == 0)
        sum1++;
      else
        sum2++;
      A[j] /= 2;
    }
    ans += (sum1 * sum2 * (ruijo(i) % 1000000007)) % 1000000007;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
