#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long MOD = 1e9 + 7;
const int N = 3e5 + 5, LOG = 6e1 + 1;
int A[LOG];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    for (int j = 0; j < LOG; j++) A[j] += (x >> j) & 1;
  }
  long long ans = 0;
  for (int i = 0; i < LOG; i++)
    ans = (ans + 1LL * A[i] * (n - A[i]) % MOD * (1LL << i) % MOD) % MOD;
  cout << ans << '\n';
  return 0;
}
