#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const long long mod = 1e9 + 7;
long long n;
long long a[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  long long mx = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  int lim = log2(mx);
  long long ans = 0;
  for (int i = 0; i <= lim; ++i) {
    long long cnt = 0;
    for (int j = 1; j <= n; ++j)
      if (a[j] & (1 << i)) cnt++;
    long long sum = (n - cnt) * cnt % mod;
    ans = (ans + sum * (((long long)1 << i) % mod) % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
