#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int LARGE_INT = 1e9 + 100;
const int INF = 2e9 + 100;
const long long INF_LL = (long long)INF * 300 * 300;
const int MOD = 1e9 + 7;
void Main() {
  int n;
  cin >> n;
  long long result = 0;
  vector<vector<int> > count(100);
  for (int i = (0); i < (100); ++i) {
    count[i].resize(2);
  }
  for (int i = (0); i < (n); ++i) {
    long long a;
    cin >> a;
    for (int j = 0; j < 100; j++, a /= 2) {
      if (a % 2 == 0) {
        result += pow(2, j) * count[j][1];
      } else {
        result += pow(2, j) * count[j][0];
      }
      result %= MOD;
      count[j][a % 2]++;
    }
  }
  cout << result << endl;
  return;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}
