#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long INF = 1e18;
const long long M = 1e9 + 7;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  std::vector<long long> v(n);
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
  }
  long long res = 0;
  for (long long i = 0; i < 60; ++i) {
    long long t = 0;
    for (long long j = 0; j < n; ++j) {
      if (v[j] >> i & 1) {
        ++t;
      }
    }
    res += t * (n - t) % M * (1ll << i) % M;
    res %= M;
  }
  cout << res << endl;
  return 0;
}
