#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18, MOD = 1e9 + 7;
const int INT_INF = 1e9, INT_MOD = 1e9 + 7;
signed main() {
  long long n;
  cin >> n;
  long long a[n + 1], maxn = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    maxn = max(maxn, a[i]);
  }
  long long ans = 0, tmp2 = 1;
  long long xo[60];
  for (long long i = 0; i < 60; i++) xo[i] = 0;
  for (long long i = 0; i < 60; i++) {
    for (long long j = 0; j < n; j++) {
      if ((a[j] >> i) & 1) xo[i]++;
    }
    ans += (tmp2 * xo[i] * (n - xo[i])) % MOD;
    ans %= MOD;
    tmp2 *= 2;
  }
  cout << ans << endl;
  return 0;
}
