#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long int ans = 0;
  long long int st = 1;
  for (int i = 0; i < 64; i++) {
    long long int c1 = 0, c2 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & 1)
        c2++;
      else
        c1++;
      a[j] /= 2;
    }
    ans = (ans + ((st * (c1 * c2) % 1000000007) % 1000000007) % 1000000007) %
          1000000007;
    st = st * 2;
    st %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
