#include <bits/stdc++.h>
using namespace std;
long long t, c, n, a, b;
long long int sumXOR(long long arr[], long long n) {
  unsigned long long int sum = 0;
  for (int i = 0; i < 32; i++) {
    int zc = 0, oc = 0;
    unsigned 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) % 1000000007 * (zc) % 1000000007) % 1000000007) *
            ((1 << i) % 1000000007);
    idsum = idsum % 1000000007;
    sum += idsum;
    sum = sum % 1000000007;
  }
  return sum;
}
string s, q;
int main() {
  cin >> n;
  long long l[n];
  for (int i = 0; i < n; i++) {
    cin >> l[i];
    cout << l[i] << endl;
  }
  cout << sumXOR(l, n) % (1000000007);
}
