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