#include <bits/stdc++.h>
using namespace std;
const long int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  long long int A[N];
  for (int i = 0; i < N; i++) {
    A[i] = 0;
    cin >> A[i];
  }
  long long int sum = 0;
  for (int i = 0; i < 60; i++) {
    int count_0 = 0;
    int count_1 = 0;
    for (int j = 0; j < N; j++) {
      if (1 & A[j])
        count_1++;
      else
        count_0++;
      A[j] = A[j] >> 1;
    }
    sum = (long long int)(sum +
                          ((long long int)(count_0 * count_1 *
                                           (long long int)(pow(2.0, float(i))) %
                                           MOD)) %
                              MOD) %
          MOD;
  }
  cout << sum;
}
