#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, a[300005], k = 1, inf = 1000000007, z, o, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= 60; i++) {
    z = o = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % 2 == 0) {
        o++;
      } else {
        z++;
      }
      a[j] /= 2;
    }
    ans += ((z * o) * k) % inf;
    ans = ans % inf, k = (k * 2) % inf;
  }
  cout << ans << endl;
  return (0);
}
