#include <bits/stdc++.h>
using namespace std;
const int MD = 1e9 + 7;
void dbg() { cerr << "\n"; }
template <typename T, typename... T2>
void dbg(const T& fst, const T2&... rst) {
  cerr << fst << ": ";
  dbg(rst...);
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  vector<long long> sm(62);
  for (int i = (0); i < (62); i++)
    for (int j = 0; j < (n); j++)
      if (a[j] >> i & 1) sm[i]++;
  long long ans = 0;
  for (int i = 0; i < (62); i++) {
    (ans += (1LL << i) % MD * sm[i] * (n - sm[i])) %= MD;
  }
  cout << ans << "\n";
  return 0;
}
