#include <bits/stdc++.h>
using namespace std;
signed main(void) {
  long long MOD = 1e9 + 7;
  long long n;
  cin >> n;
  vector<long long> one(100, 0), zero(100, 0);
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    long long j = 0;
    while (0 < (a >> j)) {
      if (((a >> j) & 1) == 1) {
        one[j]++;
      } else {
        zero[j]++;
      }
      j++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 100; i++) {
    if (one[i] != 0) zero[i] = n - one[i];
    ans = (ans +
           (((one[i] * zero[i]) % MOD) * static_cast<long long>(pow(2, i))) %
               MOD) %
          MOD;
  }
  cout << ans << endl;
  return 0;
}
