#include <bits/stdc++.h>
using namespace std;
void print() { cout << endl; }
void print(string s, bool endline = true) {
  cout << s;
  if (endline) print();
}
void print(long long int s, bool endline = true) {
  cout << s;
  if (endline) print();
}
template <typename T, typename T2>
void print(pair<T, T2>& p, bool endline = true) {
  print("(", false);
  print(p.first, false);
  print(", ", false);
  print(p.second, false);
  print(")", false);
  if (endline) print();
}
template <typename T, typename T2>
void print(map<T, T2>& m, bool endline = true) {
  print("{");
  for (auto& p : m) {
    print("  ", false);
    print(p);
  }
  print("}");
  if (endline) {
  }
}
template <typename T>
void print(vector<T>& v, bool endline = true) {
  print("[", false);
  for (size_t i = 0; i < v.size(); ++i) {
    print(v[i], false);
    if (i != v.size() - 1) print(",", false);
  }
  print("]", false);
  if (endline) print();
}
template <typename T>
vector<T> operator+(const vector<T>& a, const vector<T>& b) {
  vector<T> ret;
  ret.reserve(a.size() + b.size());
  ret.insert(ret.end(), a.begin(), a.end());
  ret.insert(ret.end(), b.begin(), b.end());
  return ret;
}
template <typename T>
vector<T>& operator+=(vector<T>& a, const vector<T>& b) {
  a.reserve(a.size() + b.size());
  a.insert(a.end(), b.begin(), b.end());
  return a;
}
int main() {
  int n;
  cin >> n;
  vector<long long int> nums;
  while (n-- > 0) {
    long long int t;
    cin >> t;
    nums.push_back(t);
  }
  long long int count = 0;
  for (int i = 0; i < 64; ++i) {
    long long int one = 0;
    long long int zero = 0;
    for (auto& c : nums) {
      if (c % 2 == 1) {
        one++;
      } else {
        zero++;
      }
      c /= 2;
    }
    count += zero * one * (1ll << i);
    count %= 1000000007;
  }
  print(count % 1000000007);
  return 0;
}
