#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
struct edge {
  long long to, costa, costb;
};
signed main() {
  long long n;
  cin >> n;
  long long a, k[60] = {};
  for (long long i = 0; i < n; i++) {
    cin >> a;
    for (long long j = 0; j < 60; j++)
      if (a & (1ll << j)) k[j]++;
  }
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    ans = (ans + ((1ll << i) % MOD) * k[i] * (n - k[i])) % MOD;
  }
  cout << ans;
  return 0;
}
