#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N = 0;
  cin >> N;
  vector<long long> A(N);
  for (int(i) = 0; (i) < (N); (i)++) {
    cin >> A.at(i);
  }
  vector<long long> keta(501, 0);
  for (int(k) = 0; (k) < (60); (k)++) {
    int s = 0;
    int t = 0;
    for (int(i) = 0; (i) < (N); (i)++) {
      if (((A.at(i) >> k) & 0x01) == 1) {
        t++;
      } else {
        s++;
      }
    }
    long long u = s * t;
    keta.at(k) = u;
  }
  for (int(k) = 0; (k) < (500); (k)++) {
    keta.at(k + 1) += (keta.at(k) / 2);
    if (keta.at(k) % 2 == 1) {
      keta.at(k) = 1;
    } else {
      keta.at(k) = 0;
    };
  }
  long long ret = 0;
  for (int(k) = 0; (k) < (501); (k)++) {
    if (keta.at(k)) {
      long long temp = 1;
      for (int(i) = 0; (i) < (k); (i)++) {
        temp *= 2;
        temp %= (1000000000 + 7);
      }
      ret += temp;
      ret %= (1000000000 + 7);
    }
  }
  cout << ret << endl;
  return 0;
}
