#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 2e5 + 5;
const long double pi = 3.14159265359;
const long long INF = (1LL << 63);
long long n, x, cnt[35], ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    for (long long j = 0; j < 31; j++)
      if (x & (1LL << j)) cnt[j]++;
  }
  for (long long j = 0; j < 31; j++) {
    ans += (1LL << j) % MOD * (cnt[j] * (n - cnt[j])) % MOD;
    ans %= MOD;
  }
  cout << ans << "\n";
  return 0;
}
