#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long INF = long long(1e18);
const long double PI = 4 * atan((long double)1);
long long power(long long x, long long n) {
  long long result = 1;
  while (n > 0) {
    if (n & 1) result = ((result) * (x));
    x = ((x) * (x));
    n >>= 1;
  }
  return result;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long solve(vector<long long> arr, long long n) {
  long long sum = 0;
  for (int i = 0; i < 32; i++) {
    int zc = 0, oc = 0;
    long long int idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = ((oc % MOD) * (zc % MOD) * ((1 << i) % MOD));
    sum = (sum + idsum) % MOD;
    sum %= MOD;
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  long long n;
  cin >> n;
  vector<long long> ar(n);
  for (auto &x : ar) cin >> x;
  long long res = solve(ar, n);
  cout << res % MOD;
}
