#include <bits/stdc++.h>
using namespace std;
static const int INTINF = (2147483647);
static const long long LLINF = (9223372036854775807);
static const int MAX = 1e5 + 1;
static const long long MOD = 1e9 + 7;
namespace Printer {
template <class T>
void print(T x) {
  cout << x << endl;
}
template <class T>
void print(vector<T> v) {
  for (int i = 0; i < (v.size()); ++i) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
template <class T>
void print(vector<vector<T> > vv) {
  for (int i = 0; i < (vv.size()); ++i) {
    for (int j = 0; j < (vv[i].size()); ++j) {
      if (j) cout << " ";
      cout << vv[i][j];
    }
    cout << endl;
  }
}
void print(pair<int, int> p) {
  cout << "(" << p.first << ", " << p.second << ")" << endl;
}
};  // namespace Printer
using namespace Printer;
int main(int argc, const char* argv[]) {
  std::ifstream in("input.txt");
  std::cin.rdbuf(in.rdbuf());
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < (n); ++i) cin >> v[i];
  long long ans = 0;
  for (int i = 0; i < (50); ++i) {
    long long one = 0;
    long long zero = 0;
    for (int j = 0; j < (n); ++j) {
      if (v[j] >> i & 1) {
        one++;
      } else {
        zero++;
      }
    }
    ans += one * zero << i;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
