#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000000 + 7;
long long mpow(long long x, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return mpow(x * x % MOD, n / 2);
  else
    return x * mpow(x, n - 1) % MOD;
}
int main() {
  cout << setprecision(10);
  vector<long long> v(70, 0);
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    long long tmp;
    cin >> tmp;
    int digit = 0;
    while (tmp > 0) {
      v.at(digit) += tmp % 2;
      tmp /= 2;
      digit++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < v.size(); i++) {
    ans += v.at(i) * ((long long)N - v.at(i)) * mpow(2, i);
    ans %= MOD;
  }
  cout << ans << endl;
}
