#include <bits/stdc++.h>
using namespace std;
void add_me(long long int &a, long long int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
void sub_me(long long int &a, long long int b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
long long int sumXOR(vector<long long int> &arr, long long int n) {
  long long int sum = 0;
  for (long long int i = 0; i < 32; i++) {
    long long int zc = 0, oc = 0;
    long long int idsum = 0;
    for (long long int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = oc * zc * (1 << i);
    add_me(sum, idsum);
  }
  return sum;
}
int main() {
  long long int n;
  cin >> n;
  vector<long long int> vec(n);
  for (long long int i = 0; i < n; i++) cin >> vec[i];
  long long int ans = 0;
  ans = sumXOR(vec, n);
  cout << ans << endl;
  return 0;
}
