#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int Mod = 1e9 + 7;
const int N = 3e5 + 3;
LL a[N];
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  LL ans = 0;
  for (int i = 0; i < 62; i++) {
    int on = 0, off = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & 1)
        on++;
      else
        off++;
      a[j] >>= 1;
    }
    LL s = off % Mod * (on % Mod) % Mod * ((1ll << i) % Mod) % Mod;
    ans = (ans + s) % Mod;
  }
  cout << ans << endl;
  return 0;
}
