#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long a[300001];
int main() {
  long long n, one = 0, zero = 0, ans = 0, d = 1;
  scanf("%I64d", &n);
  for (int i = 0; i < n; i++) scanf("%I64d", &a[i]);
  for (int i = 0; i < 63; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j] & 1) {
        one++;
      } else
        zero++;
      a[j] /= 2;
    }
    (ans += (one * zero) % mod * d) %= mod;
    (d *= 2) %= mod;
    one = zero = 0;
  }
  cout << ans << endl;
}
