#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<long long> vec(n);
  long long maks = 0;
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
    maks = max(maks, vec[i]);
  }
  sort(vec.rbegin(), vec.rend());
  long long res = 0, i = 0;
  while (vec[0] > 0) {
    long long sifir = 0, bir = 0;
    for (int i = 0; i < n; i++) {
      if (vec[i] % 2)
        bir++;
      else
        sifir++;
      vec[i] /= 2;
    }
    long long u = (long long)pow(2, i) % 1000000007;
    res = (res + (bir * sifir) * u) % 1000000007;
    i++;
  }
  cout << res;
  return 0;
}
