#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long zero, one;
  long long ans = 0;
  long long now_2 = 1;
  for (int i = 0; i < 62; i++) {
    zero = 0;
    one = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] % 2 == 0)
        zero++;
      else
        one++;
      A[j] /= 2;
    }
    ans += zero * one * now_2;
    ans %= 1000000007;
    now_2 *= 2;
  }
  ans %= 1000000007;
  while (ans < 0) ans += 1000000007;
  cout << ans;
  return 0;
}
