#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
const long long mod = 1e9 + 7;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}
inline long long modu(long long a) { return (a % mod + mod) % mod; }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N = in();
  long long answer = 0;
  vector<long long> A(N);
  for (long long(i) = 0; (i) < (N); (i)++) A[i] = in<long long>();
  for (long long(i) = 0; (i) < (62); (i)++) {
    int counter = 0;
    for (long long(l) = 0; (l) < (N); (l)++) {
      if (A[l] & 1LL << i) counter++;
    }
    answer += counter * (N - counter) * modu(1LL << i);
    answer = modu(answer);
  }
  cout << answer << "\n";
}
