#include <bits/stdc++.h>
using namespace std;
long long bit[62][2];
signed main() {
  long long n, a, biggest = 0, k = 0, p = 1, ans = 0, inf = 1000000007;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    biggest = max(biggest, a);
    for (int j = 0; j <= 61; j++) {
      bit[j][a % 2]++;
      a /= 2;
    }
  }
  while (biggest > 0) {
    biggest /= 2;
    ans += ((bit[k][0] * bit[k][1]) * p) % inf;
    ans %= inf;
    k++;
    p = (p * 2) % inf;
  }
  cout << ans << endl;
  return (0);
}
