#include <bits/stdc++.h>
using namespace std;
long long int sumXOR(long long arr[], long long n) {
  long long int sum = 0;
  for (int i = 0; i < 32; i++) {
    int zc = 0, oc = 0;
    long long int idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = (oc * zc * (1 << i)) % 1000000007;
    sum += idsum;
    sum = sum % 1000000007;
  }
  return sum % 1000000007;
}
int main() {
  long long n, i, sum = 0;
  cin >> n;
  long long arr[n + 10];
  for (i = 0; i < n; i++) cin >> arr[i];
  sum = sumXOR(arr, n);
  sum = sum % 1000000007;
  cout << sum;
  return 0;
}
