#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7LL;
int N;
bitset<60> A[300005];
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  long long a;
  for (int i = 0; i < N; ++i) {
    cin >> a;
    bitset<60> bs(a);
    A[i] = a;
  }
  long long ans = 0ll;
  for (int d = 0; d < 60; ++d) {
    long long m = 1ll << d;
    long long cnt1 = 0ll;
    long long cnt2 = 0ll;
    for (int i = 0; i < N; ++i) {
      bitset<60> bs = A[i];
      if (bs[d])
        cnt1++;
      else
        cnt2++;
    }
    long long sm = cnt1 * cnt2;
    sm %= MOD;
    ans += sm * m;
    ans %= MOD;
  }
  cout << ans << "\n";
  return 0;
}
