#include <bits/stdc++.h>
using namespace std;
int Max = 1000000;
long M = 1000000007;
int main() {
  long N;
  cin >> N;
  long cnt[65];
  for (int k = 0; k < 65; k++) cnt[k] = 0;
  long long tmp;
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    int k = 0;
    while (tmp) {
      cnt[k] += tmp % 2;
      tmp /= 2;
      k++;
    }
  }
  long ans = 0;
  long r = 1;
  for (int k = 0; k < 65; k++) {
    ans += r * (cnt[k] % M) * ((N - cnt[k]) % M);
    r *= 2;
    r = r % M;
  }
  cout << ans % M << endl;
  return 0;
}
