#include <bits/stdc++.h>
using namespace std;
const long long int MAXI = (long long int)1e9 + 7;
long long int sumXOR(long long int arr[], long long int 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);
    sum =
        (sum % (long long int)1000000007 + idsum % (long long int)1000000007) %
        (long long int)1000000007;
  }
  return sum;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << sumXOR(arr, n);
  return 0;
}
