#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 2e9;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> cnt(65);
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    long long ele = 1;
    int c = 0;
    while (a > 0) {
      ele *= 2;
      if (a % ele > 0) ++cnt[c];
      a = a - a % ele;
      ++c;
    }
  }
  long long ele = 1, ans = 0;
  for (int i = 0; i < 61; i++) {
    ans += (ele * (cnt[i] * (n - cnt[i])) % MOD) % MOD;
    ans = ans % MOD;
    ele *= 2;
  }
  cout << ans << endl;
  return 0;
}
