#include <bits/stdc++.h>
using namespace std;
long long int xorSum(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);
    sum = ((sum % 1000000007) + (idsum % 1000000007)) % 1000000007;
  }
  return sum % 1000000007;
}
int main() {
  long long int t, n, ans = 0, a[300000], p[3000], sum = 0, i, j;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum = sum + a[i];
  }
  ans = xorSum(a, n);
  ans = ans;
  cout << ans << endl;
  return 0;
}
