#include <bits/stdc++.h>
using namespace std;
class Comb {
 private:
  long long *fac, *finv, *inv;

 public:
  Comb() {
    fac = new long long[1000000];
    finv = new long long[1000000];
    inv = new long long[1000000];
    fac[0] = 1;
    for (int i = 1; i < 1000000; i++) {
      fac[i] = i * fac[i - 1];
      fac[i] %= 1000000007;
    }
    inv[1] = 1;
    for (int i = 2; i < 1000000; i++) {
      inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    }
    finv[0] = 1;
    for (int i = 1; i < 1000000; i++) {
      finv[i] = inv[i] * finv[i - 1];
      finv[i] %= 1000000007;
    }
  }
  long long calc(long long n, long long k) {
    long long c = fac[n];
    c *= finv[k];
    c %= 1000000007;
    c *= finv[n - k];
    c %= 1000000007;
    return c;
  }
};
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long c[61];
  for (long long j = 0; j < 60; j++) {
    c[j] = 0;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 60; j++) {
      if (a[i] & (1ll << j)) {
        c[j] += 1;
      }
    }
  }
  long long ans = 0;
  long long temp;
  for (long long i = 0; i < 60; i++) {
    temp = c[i] * (n - c[i]);
    temp %= 1000000007;
    ans += temp * (1ll << i);
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
